@pax2pay/model-banking 0.1.48 → 0.1.50
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/Card/Operation/Authorization.ts +19 -0
- package/Card/Operation/Card.ts +20 -0
- package/Card/Operation/Settlement.ts +19 -0
- package/Card/Operation/index.ts +5 -5
- package/Card/index.ts +12 -8
- package/Client/index.ts +2 -14
- package/Treasury/index.ts +0 -3
- package/dist/Card/Operation/Authorization.d.ts +12 -0
- package/dist/Card/Operation/Authorization.js +13 -0
- package/dist/Card/Operation/Authorization.js.map +1 -0
- package/dist/Card/Operation/Card.d.ts +13 -0
- package/dist/Card/Operation/Card.js +14 -0
- package/dist/Card/Operation/Card.js.map +1 -0
- package/dist/Card/Operation/Settlement.d.ts +12 -0
- package/dist/Card/Operation/Settlement.js +13 -0
- package/dist/Card/Operation/Settlement.js.map +1 -0
- package/dist/Card/Operation/index.d.ts +6 -6
- package/dist/Card/Operation/index.js +4 -4
- package/dist/Card/Operation/index.js.map +1 -1
- package/dist/Card/index.d.ts +2 -3
- package/dist/Card/index.js +10 -6
- package/dist/Card/index.js.map +1 -1
- package/dist/Client/index.d.ts +1 -13
- package/dist/Client/index.js +2 -12
- package/dist/Client/index.js.map +1 -1
- package/dist/Treasury/index.d.ts +0 -3
- package/dist/Treasury/index.js +0 -2
- package/dist/Treasury/index.js.map +1 -1
- package/package.json +8 -8
- package/Card/Operation/Cancel.ts +0 -15
- package/Card/Operation/Change.ts +0 -18
- package/Card/Operation/Create.ts +0 -15
- package/Client/Application.ts +0 -27
- package/Client/Me.ts +0 -42
- package/Client/Organization.ts +0 -69
- package/Client/User.ts +0 -63
- package/Treasury/Client/Treasury.ts +0 -20
- package/Treasury/Client/index.ts +0 -55
- package/dist/Card/Operation/Cancel.d.ts +0 -10
- package/dist/Card/Operation/Cancel.js +0 -11
- package/dist/Card/Operation/Cancel.js.map +0 -1
- package/dist/Card/Operation/Change.d.ts +0 -12
- package/dist/Card/Operation/Change.js +0 -13
- package/dist/Card/Operation/Change.js.map +0 -1
- package/dist/Card/Operation/Create.d.ts +0 -10
- package/dist/Card/Operation/Create.js +0 -11
- package/dist/Card/Operation/Create.js.map +0 -1
- package/dist/Client/Application.d.ts +0 -16
- package/dist/Client/Application.js +0 -20
- package/dist/Client/Application.js.map +0 -1
- package/dist/Client/Me.d.ts +0 -8
- package/dist/Client/Me.js +0 -39
- package/dist/Client/Me.js.map +0 -1
- package/dist/Client/Organization.d.ts +0 -19
- package/dist/Client/Organization.js +0 -45
- package/dist/Client/Organization.js.map +0 -1
- package/dist/Client/User.d.ts +0 -18
- package/dist/Client/User.js +0 -36
- package/dist/Client/User.js.map +0 -1
- package/dist/Treasury/Client/Treasury.d.ts +0 -11
- package/dist/Treasury/Client/Treasury.js +0 -14
- package/dist/Treasury/Client/Treasury.js.map +0 -1
- package/dist/Treasury/Client/index.d.ts +0 -39
- package/dist/Treasury/Client/index.js +0 -40
- package/dist/Treasury/Client/index.js.map +0 -1
package/Card/Operation/Create.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { isoly } from "isoly"
|
|
2
|
-
import { isly } from "isly"
|
|
3
|
-
|
|
4
|
-
export interface Create {
|
|
5
|
-
type: "create"
|
|
6
|
-
created: isoly.DateTime
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export namespace Create {
|
|
10
|
-
export const type = isly.object<Create>({
|
|
11
|
-
type: isly.string("create"),
|
|
12
|
-
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
13
|
-
})
|
|
14
|
-
export const is = type.is
|
|
15
|
-
}
|
package/Client/Application.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely"
|
|
2
|
-
import { isoly } from "isoly"
|
|
3
|
-
import { userwidgets } from "@userwidgets/model"
|
|
4
|
-
import { http } from "cloudly-http"
|
|
5
|
-
import * as rest from "cloudly-rest"
|
|
6
|
-
|
|
7
|
-
export interface EntityTags {
|
|
8
|
-
application: Record<string, isoly.DateTime | undefined>
|
|
9
|
-
organization: Record<string, isoly.DateTime | undefined>
|
|
10
|
-
user: Record<string, isoly.DateTime | undefined>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class Application extends rest.Collection<gracely.Error> {
|
|
14
|
-
constructor(client: http.Client, readonly entityTags: EntityTags) {
|
|
15
|
-
super(client)
|
|
16
|
-
}
|
|
17
|
-
async create(application: userwidgets.Application.Creatable): Promise<userwidgets.Application | gracely.Error> {
|
|
18
|
-
const result = await this.client.post<userwidgets.Application>("/widgets/application", application)
|
|
19
|
-
!gracely.Error.is(result) && (this.entityTags.application[result.id] = isoly.DateTime.now())
|
|
20
|
-
return result
|
|
21
|
-
}
|
|
22
|
-
async fetch(): Promise<userwidgets.Application | gracely.Error> {
|
|
23
|
-
const result = await this.client.get<userwidgets.Application>(`/widgets/application`)
|
|
24
|
-
!gracely.Error.is(result) && (this.entityTags.application[result.id] = isoly.DateTime.now())
|
|
25
|
-
return result
|
|
26
|
-
}
|
|
27
|
-
}
|
package/Client/Me.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely"
|
|
2
|
-
import { userwidgets } from "@userwidgets/model"
|
|
3
|
-
import * as rest from "cloudly-rest"
|
|
4
|
-
|
|
5
|
-
export class Me extends rest.Collection<gracely.Error> {
|
|
6
|
-
async login(credentials: userwidgets.User.Credentials): Promise<userwidgets.User.Key | gracely.Error> {
|
|
7
|
-
let result: gracely.Error | userwidgets.User.Key
|
|
8
|
-
if (credentials.password == undefined)
|
|
9
|
-
result = gracely.client.malformedContent("password", "string", "Password is required for login.")
|
|
10
|
-
else {
|
|
11
|
-
const token = await this.client.get<string>("/widgets/me", {
|
|
12
|
-
authorization: userwidgets.User.Credentials.toBasic({ user: credentials.user, password: credentials.password }),
|
|
13
|
-
})
|
|
14
|
-
result = gracely.Error.is(token)
|
|
15
|
-
? token
|
|
16
|
-
: (await userwidgets.User.Key.unpack(token)) ?? gracely.client.unauthorized("Failed to verify token.")
|
|
17
|
-
if (!gracely.Error.is(result)) {
|
|
18
|
-
this.client.key = result.token
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return result
|
|
22
|
-
}
|
|
23
|
-
async register(
|
|
24
|
-
tag: userwidgets.User.Tag,
|
|
25
|
-
credentials: userwidgets.User.Credentials.Register
|
|
26
|
-
): Promise<userwidgets.User.Key | gracely.Error> {
|
|
27
|
-
const token = await this.client.post<string>(`/widgets/me/${tag.token}`, credentials)
|
|
28
|
-
const result = gracely.Error.is(token)
|
|
29
|
-
? token
|
|
30
|
-
: (await userwidgets.User.Key.unpack(token)) ?? gracely.client.unauthorized("Failed to verify token.")
|
|
31
|
-
!gracely.Error.is(result) && (this.client.key = result.token)
|
|
32
|
-
return result
|
|
33
|
-
}
|
|
34
|
-
async join(tag: userwidgets.User.Tag): Promise<userwidgets.User.Key | gracely.Error> {
|
|
35
|
-
const response = await this.client.patch<string>(`/widgets/me/${tag.token}`, undefined)
|
|
36
|
-
const result = gracely.Error.is(response)
|
|
37
|
-
? response
|
|
38
|
-
: (await userwidgets.User.Key.unpack(response)) ?? gracely.client.unauthorized("Failed to verify token.")
|
|
39
|
-
!gracely.Error.is(result) && (this.client.key = result.token)
|
|
40
|
-
return result
|
|
41
|
-
}
|
|
42
|
-
}
|
package/Client/Organization.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely"
|
|
2
|
-
import { isoly } from "isoly"
|
|
3
|
-
import { userwidgets } from "@userwidgets/model"
|
|
4
|
-
import { http } from "cloudly-http"
|
|
5
|
-
import * as rest from "cloudly-rest"
|
|
6
|
-
|
|
7
|
-
export interface EntityTags {
|
|
8
|
-
application: Record<string, isoly.DateTime | undefined>
|
|
9
|
-
organization: Record<string, isoly.DateTime | undefined>
|
|
10
|
-
user: Record<string, isoly.DateTime | undefined>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class Organization extends rest.Collection<gracely.Error> {
|
|
14
|
-
constructor(client: http.Client, readonly entityTags: EntityTags) {
|
|
15
|
-
super(client)
|
|
16
|
-
}
|
|
17
|
-
async create(
|
|
18
|
-
organization: userwidgets.Organization.Creatable,
|
|
19
|
-
applicationId: string
|
|
20
|
-
): Promise<userwidgets.Organization | gracely.Error> {
|
|
21
|
-
const result = await this.client.post<userwidgets.Organization>("/api/organization", organization, {
|
|
22
|
-
application: applicationId,
|
|
23
|
-
})
|
|
24
|
-
!gracely.Error.is(result) && (this.entityTags.organization[result.id] = isoly.DateTime.now())
|
|
25
|
-
return result
|
|
26
|
-
}
|
|
27
|
-
async fetch(organizationId: string): Promise<userwidgets.Organization | gracely.Error> {
|
|
28
|
-
const result = await this.client.get<userwidgets.Organization>(`/api/organization/${organizationId}`)
|
|
29
|
-
!gracely.Error.is(result) && (this.entityTags.organization[result.id] = isoly.DateTime.now())
|
|
30
|
-
return result
|
|
31
|
-
}
|
|
32
|
-
async list(): Promise<userwidgets.Organization[] | gracely.Error> {
|
|
33
|
-
const result = await this.client.get<userwidgets.Organization[]>(`/api/organization`)
|
|
34
|
-
!gracely.Error.is(result) &&
|
|
35
|
-
result.reduce(
|
|
36
|
-
(entityTags, organization) => ((entityTags.organization[organization.id] = isoly.DateTime.now()), entityTags),
|
|
37
|
-
this.entityTags
|
|
38
|
-
)
|
|
39
|
-
return result
|
|
40
|
-
}
|
|
41
|
-
async changeName(
|
|
42
|
-
organizationId: string,
|
|
43
|
-
organization: userwidgets.Organization.Creatable,
|
|
44
|
-
applicationId: string
|
|
45
|
-
): Promise<userwidgets.Organization | gracely.Error> {
|
|
46
|
-
const entityTag = this.entityTags.organization[organizationId]
|
|
47
|
-
const result = await this.client.put<userwidgets.Organization>(
|
|
48
|
-
`/api/organization/${organizationId}/name`,
|
|
49
|
-
organization,
|
|
50
|
-
{
|
|
51
|
-
...(entityTag && { ifMatch: [entityTag] }),
|
|
52
|
-
application: applicationId,
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
!gracely.Error.is(result) && (this.entityTags.organization[result.id] = isoly.DateTime.now())
|
|
56
|
-
return result
|
|
57
|
-
}
|
|
58
|
-
async removeUser(organizationId: string, email: string) {
|
|
59
|
-
const entityTag = this.entityTags.organization[organizationId]
|
|
60
|
-
const result = await this.client.delete<userwidgets.Organization>(
|
|
61
|
-
`/api/organization/${organizationId}/user/${email}`,
|
|
62
|
-
{
|
|
63
|
-
...(entityTag && { ifMatch: [entityTag] }),
|
|
64
|
-
}
|
|
65
|
-
)
|
|
66
|
-
!gracely.Error.is(result) && (this.entityTags.organization[organizationId] = isoly.DateTime.now())
|
|
67
|
-
return result
|
|
68
|
-
}
|
|
69
|
-
}
|
package/Client/User.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely"
|
|
2
|
-
import { isoly } from "isoly"
|
|
3
|
-
import { userwidgets } from "@userwidgets/model"
|
|
4
|
-
import { http } from "cloudly-http"
|
|
5
|
-
import * as rest from "cloudly-rest"
|
|
6
|
-
|
|
7
|
-
export interface EntityTags {
|
|
8
|
-
application: Record<string, isoly.DateTime | undefined>
|
|
9
|
-
organization: Record<string, isoly.DateTime | undefined>
|
|
10
|
-
user: Record<string, isoly.DateTime | undefined>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class User extends rest.Collection<gracely.Error> {
|
|
14
|
-
constructor(client: http.Client, readonly entityTags: EntityTags) {
|
|
15
|
-
super(client)
|
|
16
|
-
}
|
|
17
|
-
async list(): Promise<userwidgets.User.Readable[] | gracely.Error> {
|
|
18
|
-
const result = await this.client.get<userwidgets.User.Readable[]>("/widgets/user")
|
|
19
|
-
!gracely.Error.is(result) &&
|
|
20
|
-
result.forEach(user => ((this.entityTags.user[user.email] = isoly.DateTime.now()), this.entityTags))
|
|
21
|
-
return result
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async changePassword(
|
|
25
|
-
email: string,
|
|
26
|
-
passwords: userwidgets.User.Password.Change
|
|
27
|
-
): Promise<gracely.Result | gracely.Error> {
|
|
28
|
-
const entityTag = this.entityTags?.user?.[email]
|
|
29
|
-
const response = await this.client.put<"">(
|
|
30
|
-
`/widgets/user/${email}/password`,
|
|
31
|
-
passwords,
|
|
32
|
-
!entityTag ? undefined : { ifMatch: [entityTag] }
|
|
33
|
-
)
|
|
34
|
-
!gracely.Error.is(response) && (this.entityTags.user[email] = isoly.DateTime.now())
|
|
35
|
-
return response == "" ? gracely.success.noContent() : response
|
|
36
|
-
}
|
|
37
|
-
async changeName(email: string, name: userwidgets.User.Name): Promise<userwidgets.User | gracely.Error> {
|
|
38
|
-
const entityTag = this.entityTags.user[email]
|
|
39
|
-
const result = await this.client.put<userwidgets.User>(
|
|
40
|
-
`/widgets/user/${email}/name`,
|
|
41
|
-
name,
|
|
42
|
-
!entityTag ? undefined : { ifMatch: [entityTag] }
|
|
43
|
-
)
|
|
44
|
-
!gracely.Error.is(result) && (this.entityTags.user[email] = isoly.DateTime.now())
|
|
45
|
-
return result
|
|
46
|
-
}
|
|
47
|
-
async updatePermissions(
|
|
48
|
-
email: string,
|
|
49
|
-
organizationId: string,
|
|
50
|
-
permissions: userwidgets.User.Permissions.Readable
|
|
51
|
-
): Promise<userwidgets.User.Readable | gracely.Error> {
|
|
52
|
-
const entityTag = this.entityTags.user[email]
|
|
53
|
-
const result = await this.client.patch<userwidgets.User.Readable>(
|
|
54
|
-
`/widgets/user/${email}/permission/${organizationId}`,
|
|
55
|
-
permissions,
|
|
56
|
-
!entityTag ? undefined : { ifMatch: [entityTag] }
|
|
57
|
-
)
|
|
58
|
-
!gracely.Error.is(result) &&
|
|
59
|
-
((this.entityTags.user[email] = isoly.DateTime.now()),
|
|
60
|
-
(this.entityTags.organization[organizationId] = isoly.DateTime.now()))
|
|
61
|
-
return result
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely"
|
|
2
|
-
import { isoly } from "isoly"
|
|
3
|
-
import { http } from "cloudly-http"
|
|
4
|
-
import * as rest from "cloudly-rest"
|
|
5
|
-
import { Result } from "../Balance"
|
|
6
|
-
import { Treasury as TreasuryModel } from "../Treasury"
|
|
7
|
-
|
|
8
|
-
export class Treasury extends rest.Collection<gracely.Error> {
|
|
9
|
-
constructor(client: http.Client) {
|
|
10
|
-
super(client)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
async change(currency: isoly.Currency, changes: Result[]): Promise<gracely.Result> {
|
|
14
|
-
return this.client.patch(`/treasury/${currency}/fiat`, changes)
|
|
15
|
-
}
|
|
16
|
-
async fetch(hour?: isoly.DateTime): Promise<TreasuryModel | gracely.Error> {
|
|
17
|
-
const path = hour ? `?time=${hour}` : ""
|
|
18
|
-
return this.client.get<TreasuryModel>(`/treasury${path}`)
|
|
19
|
-
}
|
|
20
|
-
}
|
package/Treasury/Client/index.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely"
|
|
2
|
-
import { isoly } from "isoly"
|
|
3
|
-
import { http } from "cloudly-http"
|
|
4
|
-
import * as rest from "cloudly-rest"
|
|
5
|
-
import { Application as ClientApplication } from "./../../Client/Application"
|
|
6
|
-
import { Me as ClientMe } from "./../../Client/Me"
|
|
7
|
-
import { Organization as ClientOrganization } from "./../../Client/Organization"
|
|
8
|
-
import { User as ClientUser } from "./../../Client/User"
|
|
9
|
-
import { Treasury } from "./Treasury"
|
|
10
|
-
|
|
11
|
-
export interface EntityTags {
|
|
12
|
-
application: Record<string, isoly.DateTime | undefined>
|
|
13
|
-
organization: Record<string, isoly.DateTime | undefined>
|
|
14
|
-
user: Record<string, isoly.DateTime | undefined>
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class Client extends rest.Client<gracely.Error> {
|
|
18
|
-
realm?: string
|
|
19
|
-
treasury = new Treasury(this.client)
|
|
20
|
-
entityTags: EntityTags = { application: {}, organization: {}, user: {} }
|
|
21
|
-
readonly userwidgets = {
|
|
22
|
-
me: new ClientMe(this.client),
|
|
23
|
-
user: new ClientUser(this.client, this.entityTags),
|
|
24
|
-
application: new ClientApplication(this.client, this.entityTags),
|
|
25
|
-
organization: new ClientOrganization(this.client, this.entityTags),
|
|
26
|
-
set onUnauthorized(callback: (client: rest.Client<never>) => Promise<boolean>) {
|
|
27
|
-
this.client.onUnauthorized = callback
|
|
28
|
-
},
|
|
29
|
-
client: this as Client,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static create<T = Record<string, any>>(server: string, key: string, load?: (client: http.Client) => T): Client & T {
|
|
33
|
-
let httpClient: http.Client<gracely.Error>
|
|
34
|
-
const result: Client = new Client(
|
|
35
|
-
(httpClient = new http.Client<gracely.Error>(server, key, {
|
|
36
|
-
appendHeader: request => ({ realm: result.realm }),
|
|
37
|
-
}))
|
|
38
|
-
)
|
|
39
|
-
if (load)
|
|
40
|
-
Object.assign(result, load(httpClient))
|
|
41
|
-
return result as Client & T
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export namespace Client {
|
|
46
|
-
export type Application = ClientApplication
|
|
47
|
-
export const Application = ClientApplication
|
|
48
|
-
export type Organization = ClientOrganization
|
|
49
|
-
export const Organization = ClientOrganization
|
|
50
|
-
export type Me = ClientMe
|
|
51
|
-
export const Me = ClientMe
|
|
52
|
-
export type User = ClientUser
|
|
53
|
-
export const User = ClientUser
|
|
54
|
-
export type Unauthorized = (client: rest.Client<never>) => Promise<boolean>
|
|
55
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { isoly } from "isoly";
|
|
2
|
-
import { isly } from "isly";
|
|
3
|
-
export interface Cancel {
|
|
4
|
-
type: "cancel";
|
|
5
|
-
created: isoly.DateTime;
|
|
6
|
-
}
|
|
7
|
-
export declare namespace Cancel {
|
|
8
|
-
const type: isly.object.ExtendableType<Cancel>;
|
|
9
|
-
const is: isly.Type.IsFunction<Cancel>;
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { isoly } from "isoly";
|
|
2
|
-
import { isly } from "isly";
|
|
3
|
-
export var Cancel;
|
|
4
|
-
(function (Cancel) {
|
|
5
|
-
Cancel.type = isly.object({
|
|
6
|
-
type: isly.string("cancel"),
|
|
7
|
-
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
8
|
-
});
|
|
9
|
-
Cancel.is = Cancel.type.is;
|
|
10
|
-
})(Cancel || (Cancel = {}));
|
|
11
|
-
//# sourceMappingURL=Cancel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Cancel.js","sourceRoot":"../","sources":["Card/Operation/Cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAO3B,MAAM,KAAW,MAAM,CAMtB;AAND,WAAiB,MAAM;IACT,WAAI,GAAG,IAAI,CAAC,MAAM,CAAS;QACvC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC3B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;KACzD,CAAC,CAAA;IACW,SAAE,GAAG,OAAA,IAAI,CAAC,EAAE,CAAA;AAC1B,CAAC,EANgB,MAAM,KAAN,MAAM,QAMtB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { isoly } from "isoly";
|
|
2
|
-
import { isly } from "isly";
|
|
3
|
-
import { Changeable } from "../Changeable";
|
|
4
|
-
export interface Change {
|
|
5
|
-
type: "change";
|
|
6
|
-
from: Changeable;
|
|
7
|
-
created: isoly.DateTime;
|
|
8
|
-
}
|
|
9
|
-
export declare namespace Change {
|
|
10
|
-
const type: isly.object.ExtendableType<Change>;
|
|
11
|
-
const is: isly.Type.IsFunction<Change>;
|
|
12
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { isoly } from "isoly";
|
|
2
|
-
import { isly } from "isly";
|
|
3
|
-
import { Changeable } from "../Changeable";
|
|
4
|
-
export var Change;
|
|
5
|
-
(function (Change) {
|
|
6
|
-
Change.type = isly.object({
|
|
7
|
-
type: isly.string("change"),
|
|
8
|
-
from: Changeable.type,
|
|
9
|
-
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
10
|
-
});
|
|
11
|
-
Change.is = Change.type.is;
|
|
12
|
-
})(Change || (Change = {}));
|
|
13
|
-
//# sourceMappingURL=Change.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Change.js","sourceRoot":"../","sources":["Card/Operation/Change.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAQ1C,MAAM,KAAW,MAAM,CAOtB;AAPD,WAAiB,MAAM;IACT,WAAI,GAAG,IAAI,CAAC,MAAM,CAAS;QACvC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC3B,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;KACzD,CAAC,CAAA;IACW,SAAE,GAAG,OAAA,IAAI,CAAC,EAAE,CAAA;AAC1B,CAAC,EAPgB,MAAM,KAAN,MAAM,QAOtB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { isoly } from "isoly";
|
|
2
|
-
import { isly } from "isly";
|
|
3
|
-
export interface Create {
|
|
4
|
-
type: "create";
|
|
5
|
-
created: isoly.DateTime;
|
|
6
|
-
}
|
|
7
|
-
export declare namespace Create {
|
|
8
|
-
const type: isly.object.ExtendableType<Create>;
|
|
9
|
-
const is: isly.Type.IsFunction<Create>;
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { isoly } from "isoly";
|
|
2
|
-
import { isly } from "isly";
|
|
3
|
-
export var Create;
|
|
4
|
-
(function (Create) {
|
|
5
|
-
Create.type = isly.object({
|
|
6
|
-
type: isly.string("create"),
|
|
7
|
-
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
8
|
-
});
|
|
9
|
-
Create.is = Create.type.is;
|
|
10
|
-
})(Create || (Create = {}));
|
|
11
|
-
//# sourceMappingURL=Create.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Create.js","sourceRoot":"../","sources":["Card/Operation/Create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAO3B,MAAM,KAAW,MAAM,CAMtB;AAND,WAAiB,MAAM;IACT,WAAI,GAAG,IAAI,CAAC,MAAM,CAAS;QACvC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC3B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;KACzD,CAAC,CAAA;IACW,SAAE,GAAG,OAAA,IAAI,CAAC,EAAE,CAAA;AAC1B,CAAC,EANgB,MAAM,KAAN,MAAM,QAMtB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely";
|
|
2
|
-
import { isoly } from "isoly";
|
|
3
|
-
import { userwidgets } from "@userwidgets/model";
|
|
4
|
-
import { http } from "cloudly-http";
|
|
5
|
-
import * as rest from "cloudly-rest";
|
|
6
|
-
export interface EntityTags {
|
|
7
|
-
application: Record<string, isoly.DateTime | undefined>;
|
|
8
|
-
organization: Record<string, isoly.DateTime | undefined>;
|
|
9
|
-
user: Record<string, isoly.DateTime | undefined>;
|
|
10
|
-
}
|
|
11
|
-
export declare class Application extends rest.Collection<gracely.Error> {
|
|
12
|
-
readonly entityTags: EntityTags;
|
|
13
|
-
constructor(client: http.Client, entityTags: EntityTags);
|
|
14
|
-
create(application: userwidgets.Application.Creatable): Promise<userwidgets.Application | gracely.Error>;
|
|
15
|
-
fetch(): Promise<userwidgets.Application | gracely.Error>;
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely";
|
|
2
|
-
import { isoly } from "isoly";
|
|
3
|
-
import * as rest from "cloudly-rest";
|
|
4
|
-
export class Application extends rest.Collection {
|
|
5
|
-
constructor(client, entityTags) {
|
|
6
|
-
super(client);
|
|
7
|
-
this.entityTags = entityTags;
|
|
8
|
-
}
|
|
9
|
-
async create(application) {
|
|
10
|
-
const result = await this.client.post("/widgets/application", application);
|
|
11
|
-
!gracely.Error.is(result) && (this.entityTags.application[result.id] = isoly.DateTime.now());
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
async fetch() {
|
|
15
|
-
const result = await this.client.get(`/widgets/application`);
|
|
16
|
-
!gracely.Error.is(result) && (this.entityTags.application[result.id] = isoly.DateTime.now());
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=Application.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Application.js","sourceRoot":"../","sources":["Client/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAG7B,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAQpC,MAAM,OAAO,WAAY,SAAQ,IAAI,CAAC,UAAyB;IAC9D,YAAY,MAAmB,EAAW,UAAsB;QAC/D,KAAK,CAAC,MAAM,CAAC,CAAA;QAD4B,eAAU,GAAV,UAAU,CAAY;IAEhE,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,WAA8C;QAC1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAA0B,sBAAsB,EAAE,WAAW,CAAC,CAAA;QACnG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAA;QAC5F,OAAO,MAAM,CAAA;IACd,CAAC;IACD,KAAK,CAAC,KAAK;QACV,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAA0B,sBAAsB,CAAC,CAAA;QACrF,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAA;QAC5F,OAAO,MAAM,CAAA;IACd,CAAC;CACD"}
|
package/dist/Client/Me.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely";
|
|
2
|
-
import { userwidgets } from "@userwidgets/model";
|
|
3
|
-
import * as rest from "cloudly-rest";
|
|
4
|
-
export declare class Me extends rest.Collection<gracely.Error> {
|
|
5
|
-
login(credentials: userwidgets.User.Credentials): Promise<userwidgets.User.Key | gracely.Error>;
|
|
6
|
-
register(tag: userwidgets.User.Tag, credentials: userwidgets.User.Credentials.Register): Promise<userwidgets.User.Key | gracely.Error>;
|
|
7
|
-
join(tag: userwidgets.User.Tag): Promise<userwidgets.User.Key | gracely.Error>;
|
|
8
|
-
}
|
package/dist/Client/Me.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely";
|
|
2
|
-
import { userwidgets } from "@userwidgets/model";
|
|
3
|
-
import * as rest from "cloudly-rest";
|
|
4
|
-
export class Me extends rest.Collection {
|
|
5
|
-
async login(credentials) {
|
|
6
|
-
let result;
|
|
7
|
-
if (credentials.password == undefined)
|
|
8
|
-
result = gracely.client.malformedContent("password", "string", "Password is required for login.");
|
|
9
|
-
else {
|
|
10
|
-
const token = await this.client.get("/widgets/me", {
|
|
11
|
-
authorization: userwidgets.User.Credentials.toBasic({ user: credentials.user, password: credentials.password }),
|
|
12
|
-
});
|
|
13
|
-
result = gracely.Error.is(token)
|
|
14
|
-
? token
|
|
15
|
-
: (await userwidgets.User.Key.unpack(token)) ?? gracely.client.unauthorized("Failed to verify token.");
|
|
16
|
-
if (!gracely.Error.is(result)) {
|
|
17
|
-
this.client.key = result.token;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
async register(tag, credentials) {
|
|
23
|
-
const token = await this.client.post(`/widgets/me/${tag.token}`, credentials);
|
|
24
|
-
const result = gracely.Error.is(token)
|
|
25
|
-
? token
|
|
26
|
-
: (await userwidgets.User.Key.unpack(token)) ?? gracely.client.unauthorized("Failed to verify token.");
|
|
27
|
-
!gracely.Error.is(result) && (this.client.key = result.token);
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
async join(tag) {
|
|
31
|
-
const response = await this.client.patch(`/widgets/me/${tag.token}`, undefined);
|
|
32
|
-
const result = gracely.Error.is(response)
|
|
33
|
-
? response
|
|
34
|
-
: (await userwidgets.User.Key.unpack(response)) ?? gracely.client.unauthorized("Failed to verify token.");
|
|
35
|
-
!gracely.Error.is(result) && (this.client.key = result.token);
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=Me.js.map
|
package/dist/Client/Me.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Me.js","sourceRoot":"../","sources":["Client/Me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM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QACrF,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC;YACrC,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,yBAAyB,CAAC,CAAA;QACvG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;QAC7D,OAAO,MAAM,CAAA;IACd,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,GAAyB;QACnC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAS,eAAe,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,CAAA;QACvF,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC;YACxC,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,yBAAyB,CAAC,CAAA;QAC1G,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;QAC7D,OAAO,MAAM,CAAA;IACd,CAAC;CACD"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely";
|
|
2
|
-
import { isoly } from "isoly";
|
|
3
|
-
import { userwidgets } from "@userwidgets/model";
|
|
4
|
-
import { http } from "cloudly-http";
|
|
5
|
-
import * as rest from "cloudly-rest";
|
|
6
|
-
export interface EntityTags {
|
|
7
|
-
application: Record<string, isoly.DateTime | undefined>;
|
|
8
|
-
organization: Record<string, isoly.DateTime | undefined>;
|
|
9
|
-
user: Record<string, isoly.DateTime | undefined>;
|
|
10
|
-
}
|
|
11
|
-
export declare class Organization extends rest.Collection<gracely.Error> {
|
|
12
|
-
readonly entityTags: EntityTags;
|
|
13
|
-
constructor(client: http.Client, entityTags: EntityTags);
|
|
14
|
-
create(organization: userwidgets.Organization.Creatable, applicationId: string): Promise<userwidgets.Organization | gracely.Error>;
|
|
15
|
-
fetch(organizationId: string): Promise<userwidgets.Organization | gracely.Error>;
|
|
16
|
-
list(): Promise<userwidgets.Organization[] | gracely.Error>;
|
|
17
|
-
changeName(organizationId: string, organization: userwidgets.Organization.Creatable, applicationId: string): Promise<userwidgets.Organization | gracely.Error>;
|
|
18
|
-
removeUser(organizationId: string, email: string): Promise<gracely.Error | userwidgets.Organization>;
|
|
19
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely";
|
|
2
|
-
import { isoly } from "isoly";
|
|
3
|
-
import * as rest from "cloudly-rest";
|
|
4
|
-
export class Organization extends rest.Collection {
|
|
5
|
-
constructor(client, entityTags) {
|
|
6
|
-
super(client);
|
|
7
|
-
this.entityTags = entityTags;
|
|
8
|
-
}
|
|
9
|
-
async create(organization, applicationId) {
|
|
10
|
-
const result = await this.client.post("/api/organization", organization, {
|
|
11
|
-
application: applicationId,
|
|
12
|
-
});
|
|
13
|
-
!gracely.Error.is(result) && (this.entityTags.organization[result.id] = isoly.DateTime.now());
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
async fetch(organizationId) {
|
|
17
|
-
const result = await this.client.get(`/api/organization/${organizationId}`);
|
|
18
|
-
!gracely.Error.is(result) && (this.entityTags.organization[result.id] = isoly.DateTime.now());
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
async list() {
|
|
22
|
-
const result = await this.client.get(`/api/organization`);
|
|
23
|
-
!gracely.Error.is(result) &&
|
|
24
|
-
result.reduce((entityTags, organization) => ((entityTags.organization[organization.id] = isoly.DateTime.now()), entityTags), this.entityTags);
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
async changeName(organizationId, organization, applicationId) {
|
|
28
|
-
const entityTag = this.entityTags.organization[organizationId];
|
|
29
|
-
const result = await this.client.put(`/api/organization/${organizationId}/name`, organization, {
|
|
30
|
-
...(entityTag && { ifMatch: [entityTag] }),
|
|
31
|
-
application: applicationId,
|
|
32
|
-
});
|
|
33
|
-
!gracely.Error.is(result) && (this.entityTags.organization[result.id] = isoly.DateTime.now());
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
async removeUser(organizationId, email) {
|
|
37
|
-
const entityTag = this.entityTags.organization[organizationId];
|
|
38
|
-
const result = await this.client.delete(`/api/organization/${organizationId}/user/${email}`, {
|
|
39
|
-
...(entityTag && { ifMatch: [entityTag] }),
|
|
40
|
-
});
|
|
41
|
-
!gracely.Error.is(result) && (this.entityTags.organization[organizationId] = isoly.DateTime.now());
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=Organization.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Organization.js","sourceRoot":"../","sources":["Client/Organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAG7B,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAQpC,MAAM,OAAO,YAAa,SAAQ,IAAI,CAAC,UAAyB;IAC/D,YAAY,MAAmB,EAAW,UAAsB;QAC/D,KAAK,CAAC,MAAM,CAAC,CAAA;QAD4B,eAAU,GAAV,UAAU,CAAY;IAEhE,CAAC;IACD,KAAK,CAAC,MAAM,CACX,YAAgD,EAChD,aAAqB;QAErB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CA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Ac,CAAC,CAAA;QAC9D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACnC,qBAAqB,cAAc,OAAO,EAC1C,YAAY,EACZ;YACC,GAAG,CAAC,SAAS,IAAI,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1C,WAAW,EAAE,aAAa;SAC1B,CACD,CAAA;QACD,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAA;QAC7F,OAAO,MAAM,CAAA;IACd,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,cAAsB,EAAE,KAAa;QACrD,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;QAC9D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CACtC,qBAAqB,cAAc,SAAS,KAAK,EAAE,EACnD;YACC,GAAG,CAAC,SAAS,IAAI,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;SAC1C,CACD,CAAA;QACD,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAA;QAClG,OAAO,MAAM,CAAA;IACd,CAAC;CACD"}
|
package/dist/Client/User.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely";
|
|
2
|
-
import { isoly } from "isoly";
|
|
3
|
-
import { userwidgets } from "@userwidgets/model";
|
|
4
|
-
import { http } from "cloudly-http";
|
|
5
|
-
import * as rest from "cloudly-rest";
|
|
6
|
-
export interface EntityTags {
|
|
7
|
-
application: Record<string, isoly.DateTime | undefined>;
|
|
8
|
-
organization: Record<string, isoly.DateTime | undefined>;
|
|
9
|
-
user: Record<string, isoly.DateTime | undefined>;
|
|
10
|
-
}
|
|
11
|
-
export declare class User extends rest.Collection<gracely.Error> {
|
|
12
|
-
readonly entityTags: EntityTags;
|
|
13
|
-
constructor(client: http.Client, entityTags: EntityTags);
|
|
14
|
-
list(): Promise<userwidgets.User.Readable[] | gracely.Error>;
|
|
15
|
-
changePassword(email: string, passwords: userwidgets.User.Password.Change): Promise<gracely.Result | gracely.Error>;
|
|
16
|
-
changeName(email: string, name: userwidgets.User.Name): Promise<userwidgets.User | gracely.Error>;
|
|
17
|
-
updatePermissions(email: string, organizationId: string, permissions: userwidgets.User.Permissions.Readable): Promise<userwidgets.User.Readable | gracely.Error>;
|
|
18
|
-
}
|
package/dist/Client/User.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely";
|
|
2
|
-
import { isoly } from "isoly";
|
|
3
|
-
import * as rest from "cloudly-rest";
|
|
4
|
-
export class User extends rest.Collection {
|
|
5
|
-
constructor(client, entityTags) {
|
|
6
|
-
super(client);
|
|
7
|
-
this.entityTags = entityTags;
|
|
8
|
-
}
|
|
9
|
-
async list() {
|
|
10
|
-
const result = await this.client.get("/widgets/user");
|
|
11
|
-
!gracely.Error.is(result) &&
|
|
12
|
-
result.forEach(user => ((this.entityTags.user[user.email] = isoly.DateTime.now()), this.entityTags));
|
|
13
|
-
return result;
|
|
14
|
-
}
|
|
15
|
-
async changePassword(email, passwords) {
|
|
16
|
-
const entityTag = this.entityTags?.user?.[email];
|
|
17
|
-
const response = await this.client.put(`/widgets/user/${email}/password`, passwords, !entityTag ? undefined : { ifMatch: [entityTag] });
|
|
18
|
-
!gracely.Error.is(response) && (this.entityTags.user[email] = isoly.DateTime.now());
|
|
19
|
-
return response == "" ? gracely.success.noContent() : response;
|
|
20
|
-
}
|
|
21
|
-
async changeName(email, name) {
|
|
22
|
-
const entityTag = this.entityTags.user[email];
|
|
23
|
-
const result = await this.client.put(`/widgets/user/${email}/name`, name, !entityTag ? undefined : { ifMatch: [entityTag] });
|
|
24
|
-
!gracely.Error.is(result) && (this.entityTags.user[email] = isoly.DateTime.now());
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
async updatePermissions(email, organizationId, permissions) {
|
|
28
|
-
const entityTag = this.entityTags.user[email];
|
|
29
|
-
const result = await this.client.patch(`/widgets/user/${email}/permission/${organizationId}`, permissions, !entityTag ? undefined : { ifMatch: [entityTag] });
|
|
30
|
-
!gracely.Error.is(result) &&
|
|
31
|
-
((this.entityTags.user[email] = isoly.DateTime.now()),
|
|
32
|
-
(this.entityTags.organization[organizationId] = isoly.DateTime.now()));
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=User.js.map
|
package/dist/Client/User.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"User.js","sourceRoot":"../","sources":["Client/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAG7B,OAAO,KAAK,IAAI,MAAM,cAAc,CAAA;AAQpC,MAAM,OAAO,IAAK,SAAQ,IAAI,CAAC,UAAyB;IACvD,YAAY,MAAmB,EAAW,UAAsB;QAC/D,KAAK,CAAC,MAAM,CAAC,CAAA;QAD4B,eAAU,GAAV,UAAU,CAAY;IAEhE,CAAC;IACD,KAAK,CAAC,IAAI;QACT,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAA8B,eAAe,CAAC,CAAA;QAClF,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC;YACxB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU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C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAA;QACjF,OAAO,MAAM,CAAA;IACd,CAAC;IACD,KAAK,CAAC,iBAAiB,CACtB,KAAa,EACb,cAAsB,EACtB,WAAkD;QAElD,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC7C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACrC,iBAAiB,KAAK,eAAe,cAAc,EAAE,EACrD,WAAW,EACX,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CACjD,CAAA;QACD,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC;YACxB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;gBACrD,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QACvE,OAAO,MAAM,CAAA;IACd,CAAC;CACD"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { gracely } from "gracely";
|
|
2
|
-
import { isoly } from "isoly";
|
|
3
|
-
import { http } from "cloudly-http";
|
|
4
|
-
import * as rest from "cloudly-rest";
|
|
5
|
-
import { Result } from "../Balance";
|
|
6
|
-
import { Treasury as TreasuryModel } from "../Treasury";
|
|
7
|
-
export declare class Treasury extends rest.Collection<gracely.Error> {
|
|
8
|
-
constructor(client: http.Client);
|
|
9
|
-
change(currency: isoly.Currency, changes: Result[]): Promise<gracely.Result>;
|
|
10
|
-
fetch(hour?: isoly.DateTime): Promise<TreasuryModel | gracely.Error>;
|
|
11
|
-
}
|