recal-sdk 0.2.0 → 0.2.1
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/README.md +27 -27
- package/dist/entities/organization.d.ts +2 -2
- package/dist/entities/organization.d.ts.map +1 -1
- package/dist/entities/organization.js +32 -0
- package/dist/entities/organization.js.map +1 -0
- package/dist/entities/user.d.ts +2 -2
- package/dist/entities/user.d.ts.map +1 -1
- package/dist/entities/user.js +45 -0
- package/dist/entities/user.js.map +1 -0
- package/dist/errors.js +36 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +52 -7092
- package/dist/index.js.map +1 -1
- package/dist/services/calendar.service.d.ts +2 -2
- package/dist/services/calendar.service.d.ts.map +1 -1
- package/dist/services/calendar.service.js +292 -0
- package/dist/services/calendar.service.js.map +1 -0
- package/dist/services/oauth.service.js +168 -0
- package/dist/services/oauth.service.js.map +1 -0
- package/dist/services/organizations.service.d.ts +1 -1
- package/dist/services/organizations.service.d.ts.map +1 -1
- package/dist/services/organizations.service.js +132 -0
- package/dist/services/organizations.service.js.map +1 -0
- package/dist/services/scheduling.service.d.ts +2 -2
- package/dist/services/scheduling.service.d.ts.map +1 -1
- package/dist/services/scheduling.service.js +122 -0
- package/dist/services/scheduling.service.js.map +1 -0
- package/dist/services/users.service.js +93 -0
- package/dist/services/users.service.js.map +1 -0
- package/dist/typebox/calendar.tb.d.ts +5 -4
- package/dist/typebox/calendar.tb.d.ts.map +1 -1
- package/dist/typebox/calendar.tb.js +92 -0
- package/dist/typebox/calendar.tb.js.map +1 -0
- package/dist/typebox/oauth.tb.d.ts +2 -2
- package/dist/typebox/oauth.tb.js +16 -0
- package/dist/typebox/oauth.tb.js.map +1 -0
- package/dist/typebox/organization.stripped.tb.js +7 -0
- package/dist/typebox/organization.stripped.tb.js.map +1 -0
- package/dist/typebox/organization.tb.js +8 -0
- package/dist/typebox/organization.tb.js.map +1 -0
- package/dist/typebox/scheduling.tb.js +118 -0
- package/dist/typebox/scheduling.tb.js.map +1 -0
- package/dist/typebox/timeString.tb.js +7 -0
- package/dist/typebox/timeString.tb.js.map +1 -0
- package/dist/typebox/user.stripped.tb.js +6 -0
- package/dist/typebox/user.stripped.tb.js.map +1 -0
- package/dist/typebox/user.tb.d.ts +1 -1
- package/dist/typebox/user.tb.js +10 -0
- package/dist/typebox/user.tb.js.map +1 -0
- package/dist/types/calendar.types.d.ts +2 -4
- package/dist/types/calendar.types.d.ts.map +1 -1
- package/dist/types/calendar.types.js +27 -56
- package/dist/types/calendar.types.js.map +1 -1
- package/dist/types/internal.types.js +2 -0
- package/dist/types/internal.types.js.map +1 -0
- package/dist/types/oauth.types.d.ts +1 -1
- package/dist/types/oauth.types.d.ts.map +1 -1
- package/dist/types/oauth.types.js +2 -0
- package/dist/types/oauth.types.js.map +1 -0
- package/dist/types/scheduling.types.js +2 -0
- package/dist/types/scheduling.types.js.map +1 -0
- package/dist/utils/fetch.helper.d.ts +1 -1
- package/dist/utils/fetch.helper.d.ts.map +1 -1
- package/dist/utils/fetch.helper.js +93 -0
- package/dist/utils/fetch.helper.js.map +1 -0
- package/dist/utils/fetchErrorHandler.js +32 -0
- package/dist/utils/fetchErrorHandler.js.map +1 -0
- package/dist/utils/functionize.js +6 -0
- package/dist/utils/functionize.js.map +1 -0
- package/dist/utils/includes.helper.js +10 -0
- package/dist/utils/includes.helper.js.map +1 -0
- package/dist/utils/omit.js +4 -0
- package/dist/utils/omit.js.map +1 -0
- package/package.json +7 -5
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Type as T } from '@sinclair/typebox';
|
|
2
|
+
import { User } from '../entities/user.js';
|
|
3
|
+
import { userSchema } from '../typebox/user.tb.js';
|
|
4
|
+
import { Organization } from '../entities/organization.js';
|
|
5
|
+
import { OrganizationAlreadyExistsError, OrganizationNotFoundError } from '../errors.js';
|
|
6
|
+
import { organizationSchema } from '../typebox/organization.tb.js';
|
|
7
|
+
import { errorHandler } from '../utils/fetch.helper.js';
|
|
8
|
+
export class OrganizationsService {
|
|
9
|
+
fetchHelper;
|
|
10
|
+
constructor(fetchHelper) {
|
|
11
|
+
this.fetchHelper = fetchHelper;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* List all organizations
|
|
15
|
+
* @returns An array of organizations
|
|
16
|
+
*/
|
|
17
|
+
async listAll() {
|
|
18
|
+
return this.fetchHelper
|
|
19
|
+
.get('/v1/organizations', {
|
|
20
|
+
schema: T.Array(organizationSchema),
|
|
21
|
+
})
|
|
22
|
+
.then((organizations) => organizations.map((org) => Organization.fromJson(org, this.fetchHelper)));
|
|
23
|
+
}
|
|
24
|
+
async listAllFromUser(userId) {
|
|
25
|
+
return this.fetchHelper
|
|
26
|
+
.get(`/v1/users/${userId}/organizations`, {
|
|
27
|
+
schema: T.Array(organizationSchema),
|
|
28
|
+
})
|
|
29
|
+
.catch(errorHandler([{ code: 404, result: null }]))
|
|
30
|
+
.then((orgs) => (orgs ? orgs.map((org) => Organization.fromJson(org, this.fetchHelper)) : null));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get an organization by slug
|
|
34
|
+
* @param slug The slug of the organization
|
|
35
|
+
* @returns The organization
|
|
36
|
+
*/
|
|
37
|
+
async get(slug) {
|
|
38
|
+
return this.fetchHelper
|
|
39
|
+
.get(`/v1/organizations/${slug}`, {
|
|
40
|
+
schema: organizationSchema,
|
|
41
|
+
})
|
|
42
|
+
.catch(errorHandler([{ code: 404, error: new OrganizationNotFoundError(slug) }]))
|
|
43
|
+
.then((org) => Organization.fromJson(org, this.fetchHelper));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create an organization
|
|
47
|
+
* @param slug The slug of the organization
|
|
48
|
+
* @param name The name of the organization
|
|
49
|
+
* @returns The created organization
|
|
50
|
+
*/
|
|
51
|
+
async create(slug, name) {
|
|
52
|
+
return this.fetchHelper
|
|
53
|
+
.post(`/v1/organizations`, {
|
|
54
|
+
body: { slug, name },
|
|
55
|
+
schema: organizationSchema,
|
|
56
|
+
})
|
|
57
|
+
.catch(errorHandler([{ code: 409, error: new OrganizationAlreadyExistsError(slug) }]))
|
|
58
|
+
.then((org) => Organization.fromJson(org, this.fetchHelper));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Update an organization
|
|
62
|
+
* @param slug The slug of the organization
|
|
63
|
+
* @param updatedOrganizationData The updated organization data
|
|
64
|
+
* @returns The updated organization
|
|
65
|
+
*/
|
|
66
|
+
async update(slug, updatedOrganizationData) {
|
|
67
|
+
return this.fetchHelper
|
|
68
|
+
.put(`/v1/organizations/${slug}`, {
|
|
69
|
+
body: updatedOrganizationData,
|
|
70
|
+
schema: organizationSchema,
|
|
71
|
+
})
|
|
72
|
+
.catch(errorHandler([
|
|
73
|
+
{ code: 404, error: new OrganizationNotFoundError(slug) },
|
|
74
|
+
{ code: 409, error: new OrganizationAlreadyExistsError(slug) },
|
|
75
|
+
]))
|
|
76
|
+
.then((org) => Organization.fromJson(org, this.fetchHelper));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Delete an organization
|
|
80
|
+
* @param slug The slug of the organization
|
|
81
|
+
* @returns The deleted organization
|
|
82
|
+
*/
|
|
83
|
+
async delete(slug) {
|
|
84
|
+
return this.fetchHelper
|
|
85
|
+
.delete(`/v1/organizations/${slug}`, {
|
|
86
|
+
schema: organizationSchema,
|
|
87
|
+
})
|
|
88
|
+
.catch(errorHandler([{ code: 404, error: new OrganizationNotFoundError(slug) }]))
|
|
89
|
+
.then((org) => Organization.fromJson(org, this.fetchHelper));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get the members of an organization
|
|
93
|
+
* @param slug The slug of the organization
|
|
94
|
+
* @returns The members of the organization
|
|
95
|
+
*/
|
|
96
|
+
async getMembers(slug) {
|
|
97
|
+
return this.fetchHelper
|
|
98
|
+
.get(`/v1/organizations/${slug}/members`, {
|
|
99
|
+
schema: T.Array(userSchema),
|
|
100
|
+
})
|
|
101
|
+
.catch(errorHandler([{ code: 404, error: new OrganizationNotFoundError(slug) }]))
|
|
102
|
+
.then((users) => users.map((user) => User.fromJson(user, this.fetchHelper)));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Add members to an organization
|
|
106
|
+
* @param slug The slug of the organization
|
|
107
|
+
* @param userIds The IDs of the users to add
|
|
108
|
+
* @returns The added users
|
|
109
|
+
*/
|
|
110
|
+
async addMembers(slug, userIds) {
|
|
111
|
+
return this.fetchHelper
|
|
112
|
+
.post(`/v1/organizations/${slug}/members`, {
|
|
113
|
+
body: { userIds },
|
|
114
|
+
})
|
|
115
|
+
.catch(errorHandler([{ code: 404, error: new OrganizationNotFoundError(slug) }]));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Remove members from an organization
|
|
119
|
+
* @param slug The slug of the organization
|
|
120
|
+
* @param userIds The IDs of the users to remove
|
|
121
|
+
* @returns Success message
|
|
122
|
+
*/
|
|
123
|
+
async removeMembers(slug, userIds) {
|
|
124
|
+
return this.fetchHelper
|
|
125
|
+
.delete(`/v1/organizations/${slug}/members`, {
|
|
126
|
+
body: { userIds },
|
|
127
|
+
schema: T.String(),
|
|
128
|
+
})
|
|
129
|
+
.catch(errorHandler([{ code: 404, error: new OrganizationNotFoundError(slug) }]));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=organizations.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organizations.service.js","sourceRoot":"","sources":["../../src/services/organizations.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,0B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W;aAClB,IAAI,CAAC,qBAAqB,IAAI,UAAU,EAAE;YACvC,IAAI,EAAE,EAAE,OAAO,EAAE;SACpB,CAAC;aACD,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,yBAAyB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IACzF,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,aAAa,CAAC,IAAY,EAAE,OAAiB;QACtD,OAAO,IAAI,CAAC,WAAW;aAClB,MAAM,CAAC,qBAAqB,IAAI,UAAU,EAAE;YACzC,IAAI,EAAE,EAAE,OAAO,EAAE;YACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;SACrB,CAAC;aACD,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,yBAAyB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IACzF,CAAC;CACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AdvancedSchedulingResponse, OrgSchedulingParams, Schedule, SchedulingResponse, SubOrgSchedulingResponse, UserSchedulingAdvancedParams, UserSchedulingBasicParams } from '
|
|
2
|
-
import { type FetchHelper } from '
|
|
1
|
+
import type { AdvancedSchedulingResponse, OrgSchedulingParams, Schedule, SchedulingResponse, SubOrgSchedulingResponse, UserSchedulingAdvancedParams, UserSchedulingBasicParams } from '../types/scheduling.types';
|
|
2
|
+
import { type FetchHelper } from '../utils/fetch.helper';
|
|
3
3
|
export declare class SchedulingService {
|
|
4
4
|
private fetchHelper;
|
|
5
5
|
constructor(fetchHelper: FetchHelper);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduling.service.d.ts","sourceRoot":"","sources":["../../src/services/scheduling.service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACR,0BAA0B,EAC1B,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EAClB,wBAAwB,EACxB,4BAA4B,EAC5B,yBAAyB,EAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"scheduling.service.d.ts","sourceRoot":"","sources":["../../src/services/scheduling.service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACR,0BAA0B,EAC1B,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EAClB,wBAAwB,EACxB,4BAA4B,EAC5B,yBAAyB,EAC5B,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAIrE,qBAAa,iBAAiB;IACd,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAE5C;;;;;;;;;;;;;OAaG;IACU,mBAAmB,CAC5B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,IAAI,EACf,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,yBAAyB,GACnC,OAAO,CAAC,kBAAkB,CAAC;IA0B9B;;;;;;;;;;;;OAYG;IACU,sBAAsB,CAC/B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,QAAQ,EAAE,EACrB,SAAS,EAAE,IAAI,EACf,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,4BAA4B,GACtC,OAAO,CAAC,0BAA0B,CAAC;IA2BtC;;;;;;;;;;;;;OAaG;IACU,sBAAsB,CAC/B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,IAAI,EACf,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,mBAAmB,GAC7B,OAAO,CAAC,wBAAwB,CAAC;CAkCvC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { advancedSchedulingResponseSchema, schedulingResponseSchema, subOrgSchedulingResponseSchema, } from '../typebox/scheduling.tb.js';
|
|
2
|
+
import { errorHandler } from '../utils/fetch.helper.js';
|
|
3
|
+
import { omit } from '../utils/omit.js';
|
|
4
|
+
import { OAuthConnectionNotFoundError, OrganizationNotFoundError, UserNotFoundError } from '../errors.js';
|
|
5
|
+
export class SchedulingService {
|
|
6
|
+
fetchHelper;
|
|
7
|
+
constructor(fetchHelper) {
|
|
8
|
+
this.fetchHelper = fetchHelper;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get available time slots based on busy data with basic parameters
|
|
12
|
+
* @param userId The ID of the user
|
|
13
|
+
* @param startDate The start date for availability search
|
|
14
|
+
* @param endDate The end date for availability search
|
|
15
|
+
* @param options Scheduling options (all fields optional):
|
|
16
|
+
* - provider: Calendar provider(s) to check (optional)
|
|
17
|
+
* - padding: Minutes of padding between slots (optional)
|
|
18
|
+
* - slotDuration: Duration of each slot in minutes (optional)
|
|
19
|
+
* - earliestTimeEachDay: Earliest time each day (HH:mm format) (optional)
|
|
20
|
+
* - latestTimeEachDay: Latest time each day (HH:mm format) (optional)
|
|
21
|
+
* - timeZone: Time zone for the request (optional)
|
|
22
|
+
* @returns Available time slots with basic scheduling options
|
|
23
|
+
*/
|
|
24
|
+
async userSchedulingBasic(userId, startDate, endDate, options) {
|
|
25
|
+
return this.fetchHelper
|
|
26
|
+
.get(`/v1/users/${userId}/scheduling`, {
|
|
27
|
+
schema: schedulingResponseSchema,
|
|
28
|
+
searchParams: {
|
|
29
|
+
...omit(options, ['timeZone']),
|
|
30
|
+
startDate,
|
|
31
|
+
endDate,
|
|
32
|
+
},
|
|
33
|
+
headers: options.timeZone ? { 'x-timezone': options.timeZone } : undefined,
|
|
34
|
+
})
|
|
35
|
+
.catch(errorHandler([
|
|
36
|
+
{
|
|
37
|
+
code: 404,
|
|
38
|
+
error: new OAuthConnectionNotFoundError(userId, Array.isArray(options.provider) ? options.provider.join(',') : options.provider || 'unknown'),
|
|
39
|
+
statusTextInclFilter: 'User has no connected calendars',
|
|
40
|
+
},
|
|
41
|
+
{ code: 404, error: new UserNotFoundError(userId) },
|
|
42
|
+
]));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get available time slots based on busy data with advanced parameters
|
|
46
|
+
* @param userId The ID of the user
|
|
47
|
+
* @param schedules Array of schedule rules defining availability windows
|
|
48
|
+
* @param startDate The start date for availability search
|
|
49
|
+
* @param endDate The end date for availability search
|
|
50
|
+
* @param options Advanced scheduling options (all fields optional):
|
|
51
|
+
* - provider: Calendar provider(s) to check (optional)
|
|
52
|
+
* - padding: Minutes of padding between slots (optional)
|
|
53
|
+
* - slotDuration: Duration of each slot in minutes (optional)
|
|
54
|
+
* - timeZone: Time zone for the request (optional)
|
|
55
|
+
* @returns Available time slots with advanced scheduling options
|
|
56
|
+
*/
|
|
57
|
+
async userSchedulingAdvanced(userId, schedules, startDate, endDate, options) {
|
|
58
|
+
return this.fetchHelper
|
|
59
|
+
.post(`/v1/users/${userId}/scheduling`, {
|
|
60
|
+
schema: advancedSchedulingResponseSchema,
|
|
61
|
+
searchParams: {
|
|
62
|
+
...omit(options, ['timeZone']),
|
|
63
|
+
startDate,
|
|
64
|
+
endDate,
|
|
65
|
+
},
|
|
66
|
+
body: { schedules },
|
|
67
|
+
headers: options.timeZone ? { 'x-timezone': options.timeZone } : undefined,
|
|
68
|
+
})
|
|
69
|
+
.catch(errorHandler([
|
|
70
|
+
{
|
|
71
|
+
code: 404,
|
|
72
|
+
error: new OAuthConnectionNotFoundError(userId, Array.isArray(options.provider) ? options.provider.join(',') : options.provider || 'unknown'),
|
|
73
|
+
statusTextInclFilter: 'User has no connected calendars',
|
|
74
|
+
},
|
|
75
|
+
{ code: 404, error: new UserNotFoundError(userId) },
|
|
76
|
+
]));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get available time slots based on busy data for an organization
|
|
80
|
+
* @param orgSlug The slug of the organization
|
|
81
|
+
* @param startDate The start date for availability search
|
|
82
|
+
* @param endDate The end date for availability search
|
|
83
|
+
* @param options Organization scheduling options (all fields optional):
|
|
84
|
+
* - provider: Calendar provider(s) to check (optional)
|
|
85
|
+
* - padding: Minutes of padding between slots (optional)
|
|
86
|
+
* - slotDuration: Duration of each slot in minutes (optional)
|
|
87
|
+
* - earliestTimeEachDay: Earliest time each day (HH:mm format) (optional)
|
|
88
|
+
* - latestTimeEachDay: Latest time each day (HH:mm format) (optional)
|
|
89
|
+
* - timeZone: Time zone for the request (optional)
|
|
90
|
+
* @returns Available time slots for the organization
|
|
91
|
+
*/
|
|
92
|
+
async getOrgWideAvailability(orgSlug, startDate, endDate, options) {
|
|
93
|
+
return this.fetchHelper
|
|
94
|
+
.get(`/v1/organizations/${orgSlug}/scheduling`, {
|
|
95
|
+
schema: subOrgSchedulingResponseSchema,
|
|
96
|
+
searchParams: {
|
|
97
|
+
...omit(options, ['timeZone']),
|
|
98
|
+
startDate,
|
|
99
|
+
endDate,
|
|
100
|
+
},
|
|
101
|
+
headers: options.timeZone ? { 'x-timezone': options.timeZone } : undefined,
|
|
102
|
+
})
|
|
103
|
+
.catch(errorHandler([
|
|
104
|
+
{
|
|
105
|
+
code: 400,
|
|
106
|
+
statusTextInclFilter: 'User has no connected calendars',
|
|
107
|
+
error: new OAuthConnectionNotFoundError('organization', Array.isArray(options.provider) ? options.provider.join(',') : options.provider || 'unknown'),
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
code: 404,
|
|
111
|
+
statusTextInclFilter: 'Organization not found',
|
|
112
|
+
error: new OrganizationNotFoundError(orgSlug),
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
code: 404,
|
|
116
|
+
statusTextInclFilter: 'No users found in this organization',
|
|
117
|
+
error: new UserNotFoundError('organization'),
|
|
118
|
+
},
|
|
119
|
+
]));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=scheduling.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduling.service.js","sourceRoot":"","sources":["../../src/services/scheduling.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gCAAgC,EAChC,wBAAwB,EACxB,8BAA8B,GACjC,MAAM,yBAAyB,CAAA;AAUhC,OAAO,EAAE,YA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CAAC,CAAC,CAAC,SAAS;SAC7E,CAAC;aACD,KAAK,CACF,YAAY,CAAC;YACT;gBACI,IAAI,EAAE,GAAG;gBACT,oBAAoB,EAAE,iCAAiC;gBACvD,KAAK,EAAE,IAAI,4BAA4B,CACnC,cAAc,EACd,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,IAAI,SAAS,CAC/F;aACJ;YACD;gBACI,IAAI,EAAE,GAAG;gBACT,oBAAoB,EAAE,wBAAwB;gBAC9C,KAAK,EAAE,IAAI,yBAAyB,CAAC,OAAO,CAAC;aAChD;YACD;gBACI,IAAI,EAAE,GAAG;gBACT,oBAAoB,EAAE,qCAAqC;gBAC3D,KAAK,EAAE,IAAI,iBAAiB,CAAC,cAAc,CAAC;aAC/C;SACJ,CAAC,CACL,CAAA;IACT,CAAC;CACJ"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Type as T } from '@sinclair/typebox';
|
|
2
|
+
import { OrganizationNotFoundError, UserAlreadyExistsError, UserNotFoundError } from '../errors.js';
|
|
3
|
+
import { includesHelper } from '../utils/includes.helper.js';
|
|
4
|
+
import { User } from '../entities/user.js';
|
|
5
|
+
import { userSchema } from '../typebox/user.tb.js';
|
|
6
|
+
import { errorHandler } from '../utils/fetch.helper.js';
|
|
7
|
+
export class UsersService {
|
|
8
|
+
fetchHelper;
|
|
9
|
+
constructor(fetchHelper) {
|
|
10
|
+
this.fetchHelper = fetchHelper;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* List all users
|
|
14
|
+
* @returns An array of users
|
|
15
|
+
*/
|
|
16
|
+
async listAll() {
|
|
17
|
+
return this.fetchHelper
|
|
18
|
+
.get('/v1/users', { schema: T.Array(userSchema) })
|
|
19
|
+
.then((users) => users.map((user) => User.fromJson(user, this.fetchHelper)));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get a user by ID
|
|
23
|
+
* @param id The ID of the user
|
|
24
|
+
* @param options Options for the user
|
|
25
|
+
* @returns The user
|
|
26
|
+
*/
|
|
27
|
+
async get(id, { includeOrgs = false, includeOAuth = false }) {
|
|
28
|
+
return this.fetchHelper
|
|
29
|
+
.get(`/v1/users/${id}`, {
|
|
30
|
+
schema: userSchema,
|
|
31
|
+
searchParams: {
|
|
32
|
+
...includesHelper([
|
|
33
|
+
[includeOrgs, 'organizations'],
|
|
34
|
+
[includeOAuth, 'oauthConnections'],
|
|
35
|
+
]),
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
.catch(errorHandler([{ code: 404, result: null }]))
|
|
39
|
+
.then((user) => (user ? User.fromJson(user, this.fetchHelper) : null));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create a new user
|
|
43
|
+
* @param id The ID of the user
|
|
44
|
+
* @param organizationSlugs The slugs of the organizations the user is a member of
|
|
45
|
+
* @returns The new user
|
|
46
|
+
*/
|
|
47
|
+
async create(id, organizationSlugs) {
|
|
48
|
+
return this.fetchHelper
|
|
49
|
+
.post(`/v1/users`, {
|
|
50
|
+
body: { id, organizationSlugs },
|
|
51
|
+
schema: userSchema,
|
|
52
|
+
})
|
|
53
|
+
.catch(errorHandler([
|
|
54
|
+
{ code: 404, error: new OrganizationNotFoundError(id) },
|
|
55
|
+
{ code: 409, error: new UserAlreadyExistsError(id) },
|
|
56
|
+
]))
|
|
57
|
+
.then((user) => User.fromJson(user, this.fetchHelper));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Update a user
|
|
61
|
+
* @param id The ID of the user
|
|
62
|
+
* @param updatedUserData The updated user data
|
|
63
|
+
* @returns The updated user
|
|
64
|
+
*/
|
|
65
|
+
async update(id, updatedUserData) {
|
|
66
|
+
return this.fetchHelper
|
|
67
|
+
.put(`/v1/users/${id}`, {
|
|
68
|
+
body: {
|
|
69
|
+
userId: updatedUserData.id,
|
|
70
|
+
},
|
|
71
|
+
schema: userSchema,
|
|
72
|
+
})
|
|
73
|
+
.catch(errorHandler([
|
|
74
|
+
{ code: 404, result: null },
|
|
75
|
+
{ code: 409, error: new UserAlreadyExistsError(id) },
|
|
76
|
+
]))
|
|
77
|
+
.then((updatedUser) => (updatedUser ? User.fromJson(updatedUser, this.fetchHelper) : null));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Delete a user
|
|
81
|
+
* @param id The ID of the user
|
|
82
|
+
* @returns The deleted user
|
|
83
|
+
*/
|
|
84
|
+
async delete(id) {
|
|
85
|
+
return this.fetchHelper
|
|
86
|
+
.delete(`/v1/users/${id}`, {
|
|
87
|
+
schema: userSchema,
|
|
88
|
+
})
|
|
89
|
+
.catch(errorHandler([{ code: 404, error: new UserNotFoundError(id) }]))
|
|
90
|
+
.then((user) => User.fromJson(user, this.fetchHelper));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=users.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.service.js","sourceRoot":"","sources":["../../src/services/users.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAoB,MAAM,uBAAuB,CAAA;AAOtE,MAAM,OAAO,YAAY;IACD;IAApB,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEhD;;;OAGG;IACI,KAAK,CAAC,OAAO;QAChB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AAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;IAC9D,CAAC;CACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AttendeeResponseStatus
|
|
2
|
-
export declare const providerSchema: import("@sinclair/typebox").
|
|
1
|
+
import { AttendeeResponseStatus } from '../types/calendar.types';
|
|
2
|
+
export declare const providerSchema: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"google" | "microsoft">[]>;
|
|
3
3
|
export declare const attendeeResponseStatusSchema: import("@sinclair/typebox").TEnum<typeof AttendeeResponseStatus>;
|
|
4
4
|
export declare const calendarSchema: import("@sinclair/typebox").TObject<{
|
|
5
5
|
id: import("@sinclair/typebox").TString;
|
|
@@ -27,6 +27,7 @@ export declare const createAttendeeSchema: import("@sinclair/typebox").TObject<{
|
|
|
27
27
|
export declare const eventSchema: import("@sinclair/typebox").TObject<{
|
|
28
28
|
id: import("@sinclair/typebox").TString;
|
|
29
29
|
metaId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
30
|
+
calendarId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
30
31
|
subject: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
31
32
|
description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
32
33
|
start: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TDate>;
|
|
@@ -66,7 +67,7 @@ export declare const createEventAcrossCalendarsSchema: import("@sinclair/typebox
|
|
|
66
67
|
attendees: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
67
68
|
email: import("@sinclair/typebox").TString;
|
|
68
69
|
}>>>;
|
|
69
|
-
sendNotificationsFor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").
|
|
70
|
+
sendNotificationsFor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"google" | "microsoft">[]>>>;
|
|
70
71
|
meeting: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TObject<{
|
|
71
72
|
url: import("@sinclair/typebox").TString;
|
|
72
73
|
}>]>>;
|
|
@@ -96,7 +97,7 @@ export declare const updateEventAcrossCalendarsSchema: import("@sinclair/typebox
|
|
|
96
97
|
attendees: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
97
98
|
email: import("@sinclair/typebox").TString;
|
|
98
99
|
}>>>;
|
|
99
|
-
sendNotificationsFor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").
|
|
100
|
+
sendNotificationsFor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"google" | "microsoft">[]>>>;
|
|
100
101
|
meeting: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TObject<{
|
|
101
102
|
url: import("@sinclair/typebox").TString;
|
|
102
103
|
}>]>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.tb.d.ts","sourceRoot":"","sources":["../../src/typebox/calendar.tb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"calendar.tb.d.ts","sourceRoot":"","sources":["../../src/typebox/calendar.tb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAa,MAAM,yBAAyB,CAAA;AAE3E,eAAO,MAAM,cAAc,oGAA4D,CAAA;AAEvF,eAAO,MAAM,4BAA4B,kEAAiC,CAAA;AAE1E,eAAO,MAAM,cAAc;;;;;;;;;EASzB,CAAA;AAEF,eAAO,MAAM,aAAa;;EAExB,CAAA;AAEF,eAAO,MAAM,cAAc;;;;;;IASzB,CAAA;AAEF,eAAO,MAAM,oBAAoB;;EAE/B,CAAA;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;EAWtB,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;EAU5B,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;EAU3C,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;EAU5B,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;EAU3C,CAAA;AAEF,eAAO,MAAM,eAAe;;;EAG1B,CAAA;AAEF,eAAO,MAAM,UAAU;;;GAA2B,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Type as T } from '@sinclair/typebox';
|
|
2
|
+
import { AttendeeResponseStatus, providers } from '../types/calendar.types.js';
|
|
3
|
+
export const providerSchema = T.Union(providers.map((provider) => T.Literal(provider)));
|
|
4
|
+
export const attendeeResponseStatusSchema = T.Enum(AttendeeResponseStatus);
|
|
5
|
+
export const calendarSchema = T.Object({
|
|
6
|
+
id: T.String(),
|
|
7
|
+
timeZone: T.Optional(T.String()),
|
|
8
|
+
subject: T.Optional(T.String()),
|
|
9
|
+
backgroundColor: T.Optional(T.String()),
|
|
10
|
+
foregroundColor: T.Optional(T.String()),
|
|
11
|
+
selected: T.Optional(T.Boolean()),
|
|
12
|
+
accessRole: T.Optional(T.String()),
|
|
13
|
+
original: T.Any(),
|
|
14
|
+
});
|
|
15
|
+
export const meetingSchema = T.Object({
|
|
16
|
+
url: T.String(),
|
|
17
|
+
});
|
|
18
|
+
export const attendeeSchema = T.Union([
|
|
19
|
+
T.Object({
|
|
20
|
+
email: T.String(),
|
|
21
|
+
responseStatus: T.Optional(attendeeResponseStatusSchema),
|
|
22
|
+
}),
|
|
23
|
+
T.Object({
|
|
24
|
+
email: T.String(),
|
|
25
|
+
self: T.Boolean(),
|
|
26
|
+
}),
|
|
27
|
+
]);
|
|
28
|
+
export const createAttendeeSchema = T.Object({
|
|
29
|
+
email: T.String(),
|
|
30
|
+
});
|
|
31
|
+
export const eventSchema = T.Object({
|
|
32
|
+
id: T.String(),
|
|
33
|
+
metaId: T.Optional(T.String()),
|
|
34
|
+
calendarId: T.Optional(T.String()),
|
|
35
|
+
subject: T.Optional(T.String()),
|
|
36
|
+
description: T.Optional(T.String()),
|
|
37
|
+
start: T.Optional(T.Date()),
|
|
38
|
+
end: T.Optional(T.Date()),
|
|
39
|
+
location: T.Optional(T.String()),
|
|
40
|
+
attendees: T.Array(attendeeSchema),
|
|
41
|
+
original: T.Any(),
|
|
42
|
+
});
|
|
43
|
+
export const createEventSchema = T.Object({
|
|
44
|
+
metaId: T.Optional(T.String()),
|
|
45
|
+
subject: T.Optional(T.String()),
|
|
46
|
+
description: T.Optional(T.String()),
|
|
47
|
+
start: T.Optional(T.Date()),
|
|
48
|
+
end: T.Optional(T.Date()),
|
|
49
|
+
location: T.Optional(T.String()),
|
|
50
|
+
attendees: T.Optional(T.Array(createAttendeeSchema)),
|
|
51
|
+
sendNotifications: T.Optional(T.Boolean()),
|
|
52
|
+
meeting: T.Optional(T.Union([T.Boolean(), meetingSchema])),
|
|
53
|
+
});
|
|
54
|
+
export const createEventAcrossCalendarsSchema = T.Object({
|
|
55
|
+
id: T.Optional(T.String()),
|
|
56
|
+
subject: T.Optional(T.String()),
|
|
57
|
+
description: T.Optional(T.String()),
|
|
58
|
+
start: T.Optional(T.Date()),
|
|
59
|
+
end: T.Optional(T.Date()),
|
|
60
|
+
location: T.Optional(T.String()),
|
|
61
|
+
attendees: T.Optional(T.Array(createAttendeeSchema)),
|
|
62
|
+
sendNotificationsFor: T.Optional(T.Array(providerSchema)),
|
|
63
|
+
meeting: T.Optional(T.Union([T.Boolean(), meetingSchema])),
|
|
64
|
+
});
|
|
65
|
+
export const updateEventSchema = T.Object({
|
|
66
|
+
id: T.Optional(T.String()),
|
|
67
|
+
subject: T.Optional(T.String()),
|
|
68
|
+
description: T.Optional(T.String()),
|
|
69
|
+
start: T.Optional(T.Date()),
|
|
70
|
+
end: T.Optional(T.Date()),
|
|
71
|
+
location: T.Optional(T.String()),
|
|
72
|
+
attendees: T.Optional(T.Array(createAttendeeSchema)),
|
|
73
|
+
sendNotifications: T.Optional(T.Boolean()),
|
|
74
|
+
meeting: T.Optional(T.Union([T.Boolean(), meetingSchema])),
|
|
75
|
+
});
|
|
76
|
+
export const updateEventAcrossCalendarsSchema = T.Object({
|
|
77
|
+
metaId: T.String(),
|
|
78
|
+
subject: T.Optional(T.String()),
|
|
79
|
+
description: T.Optional(T.String()),
|
|
80
|
+
start: T.Optional(T.Date()),
|
|
81
|
+
end: T.Optional(T.Date()),
|
|
82
|
+
location: T.Optional(T.String()),
|
|
83
|
+
attendees: T.Optional(T.Array(createAttendeeSchema)),
|
|
84
|
+
sendNotificationsFor: T.Optional(T.Array(providerSchema)),
|
|
85
|
+
meeting: T.Optional(T.Union([T.Boolean(), meetingSchema])),
|
|
86
|
+
});
|
|
87
|
+
export const timeRangeSchema = T.Object({
|
|
88
|
+
start: T.Date(),
|
|
89
|
+
end: T.Date(),
|
|
90
|
+
});
|
|
91
|
+
export const busySchema = T.Array(timeRangeSchema);
|
|
92
|
+
//# sourceMappingURL=calendar.tb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.tb.js","sourceRoot":"","sources":["../../src/typebox/calendar.tb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAE3E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CA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,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAChC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACpD,oBAAoB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACzD,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC;CAC7D,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE;IACf,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE;CAChB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const oauthConnectionSchema: import("@sinclair/typebox").TObject<{
|
|
2
2
|
expiresAt: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TDate, import("@sinclair/typebox").TNull]>;
|
|
3
|
-
provider: import("@sinclair/typebox").
|
|
3
|
+
provider: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"google" | "microsoft">[]>;
|
|
4
4
|
accessToken: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
5
5
|
refreshToken: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
|
6
6
|
email: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
@@ -8,7 +8,7 @@ export declare const oauthConnectionSchema: import("@sinclair/typebox").TObject<
|
|
|
8
8
|
alive: import("@sinclair/typebox").TBoolean;
|
|
9
9
|
}>;
|
|
10
10
|
export declare const oauthLinkSchema: import("@sinclair/typebox").TObject<{
|
|
11
|
-
provider: import("@sinclair/typebox").
|
|
11
|
+
provider: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"google" | "microsoft">[]>;
|
|
12
12
|
url: import("@sinclair/typebox").TString;
|
|
13
13
|
}>;
|
|
14
14
|
//# sourceMappingURL=oauth.tb.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Type as T } from '@sinclair/typebox';
|
|
2
|
+
import { providerSchema } from './calendar.tb.js';
|
|
3
|
+
export const oauthConnectionSchema = T.Object({
|
|
4
|
+
expiresAt: T.Union([T.Date(), T.Null()]),
|
|
5
|
+
provider: providerSchema,
|
|
6
|
+
accessToken: T.Optional(T.String()),
|
|
7
|
+
refreshToken: T.Optional(T.Union([T.String(), T.Null()])),
|
|
8
|
+
email: T.Union([T.String(), T.Null()]),
|
|
9
|
+
scope: T.Array(T.String()),
|
|
10
|
+
alive: T.Boolean(),
|
|
11
|
+
});
|
|
12
|
+
export const oauthLinkSchema = T.Object({
|
|
13
|
+
provider: providerSchema,
|
|
14
|
+
url: T.String(),
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=oauth.tb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.tb.js","sourceRoot":"","sources":["../../src/typebox/oauth.tb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACxC,QAAQ,EAAE,cAAc;IACxB,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACnC,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACzD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,QAAQ,EAAE,cAAc;IACxB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization.stripped.tb.js","sourceRoot":"","sources":["../../src/typebox/organization.stripped.tb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAE7C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE;CACtB,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Type as T } from '@sinclair/typebox';
|
|
2
|
+
import { strippedOrganizationSchema } from './organization.stripped.tb.js';
|
|
3
|
+
import { strippedUserSchema } from './user.stripped.tb.js';
|
|
4
|
+
export const organizationSchema = T.Object({
|
|
5
|
+
...strippedOrganizationSchema.properties,
|
|
6
|
+
members: T.Optional(T.Array(strippedUserSchema)),
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=organization.tb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization.tb.js","sourceRoot":"","sources":["../../src/typebox/organization.tb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,GAAG,0BAA0B,CAAC,UAAU;IACxC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;CACnD,CAAC,CAAA"}
|