@go-mondo/identity-sdk 0.0.2-beta.39 → 0.0.2-beta.40
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/.release-please-manifest.json +1 -1
- package/.tsbuildinfo/cjs.json +1 -1
- package/.tsbuildinfo/esm.json +1 -1
- package/CHANGELOG.md +7 -0
- package/dist/cjs/app/authorization/resources.js +1 -1
- package/dist/cjs/app/oauth/resources.js +1 -1
- package/dist/cjs/app/oidc/resources.js +2 -2
- package/dist/cjs/app/registration/resources.js +1 -1
- package/dist/cjs/app/resources.js +2 -2
- package/dist/cjs/app/saml/resources.js +2 -2
- package/dist/cjs/association/resources.js +1 -1
- package/dist/cjs/association/schema.d.ts +53 -9
- package/dist/cjs/association/schema.d.ts.map +1 -1
- package/dist/cjs/association/schema.js +8 -9
- package/dist/cjs/association/schema.test.js +1 -50
- package/dist/cjs/authentication/settings/resources.js +1 -1
- package/dist/cjs/authentication/strategies/resources.js +2 -2
- package/dist/cjs/authorization/permissions/resources.js +2 -2
- package/dist/cjs/authorization/roles/resources.js +2 -2
- package/dist/cjs/common/resources/operations.d.ts +3 -2
- package/dist/cjs/common/resources/operations.d.ts.map +1 -1
- package/dist/cjs/common/resources/operations.js +15 -8
- package/dist/cjs/common/resources/operations.test.js +15 -15
- package/dist/cjs/customer/users/resources.js +2 -2
- package/dist/esm/app/authorization/resources.js +2 -2
- package/dist/esm/app/oauth/resources.js +2 -2
- package/dist/esm/app/oidc/resources.js +3 -3
- package/dist/esm/app/registration/resources.js +2 -2
- package/dist/esm/app/resources.js +3 -3
- package/dist/esm/app/saml/resources.js +3 -3
- package/dist/esm/association/resources.js +2 -2
- package/dist/esm/association/schema.d.ts +53 -9
- package/dist/esm/association/schema.d.ts.map +1 -1
- package/dist/esm/association/schema.js +3 -4
- package/dist/esm/association/schema.test.js +2 -51
- package/dist/esm/authentication/settings/resources.js +2 -2
- package/dist/esm/authentication/strategies/resources.js +3 -3
- package/dist/esm/authorization/permissions/resources.js +3 -3
- package/dist/esm/authorization/roles/resources.js +3 -3
- package/dist/esm/common/resources/operations.d.ts +3 -2
- package/dist/esm/common/resources/operations.d.ts.map +1 -1
- package/dist/esm/common/resources/operations.js +12 -6
- package/dist/esm/common/resources/operations.test.js +16 -16
- package/dist/esm/customer/users/resources.js +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getItemWithAuthorization,
|
|
1
|
+
import { getItemWithAuthorization, postItemWithAuthorization, } from '../../common/resources/operations.js';
|
|
2
2
|
import { PATH } from '../resources.js';
|
|
3
3
|
import { RegistrationSchema, UpsertRegistrationPayloadSchema, } from './schema.js';
|
|
4
4
|
const RESOURCE = 'registration';
|
|
@@ -24,5 +24,5 @@ export async function getRegistration(instance, id) {
|
|
|
24
24
|
return RegistrationSchema.parse(await getItemWithAuthorization(new URL(RegistrationResources.buildPath(id), instance.config.host), instance.authorizer));
|
|
25
25
|
}
|
|
26
26
|
export async function upsertRegistration(instance, id, item) {
|
|
27
|
-
return RegistrationSchema.parse(await
|
|
27
|
+
return RegistrationSchema.parse(await postItemWithAuthorization(new URL(RegistrationResources.buildPath(id), instance.config.host), instance.authorizer, UpsertRegistrationPayloadSchema.parse(item)));
|
|
28
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deleteItemWithAuthorization, getItemWithAuthorization,
|
|
1
|
+
import { deleteItemWithAuthorization, getItemWithAuthorization, patchItemWithAuthorization, postItemWithAuthorization, } from '../common/resources/operations.js';
|
|
2
2
|
import { addPaginationToURL } from '../common/resources/utils.js';
|
|
3
3
|
import { PaginationCollectionSchema, } from '../common/schema/collection.js';
|
|
4
4
|
import { AppSchema, InsertAppPayloadSchema, UpdateAppPayloadSchema, } from './schema.js';
|
|
@@ -38,10 +38,10 @@ export async function getApp(instance, id) {
|
|
|
38
38
|
return AppSchema.parse(await getItemWithAuthorization(new URL(AppResources.buildPath(id), instance.config.host), instance.authorizer));
|
|
39
39
|
}
|
|
40
40
|
export async function insertApp(instance, item) {
|
|
41
|
-
return AppSchema.parse(await
|
|
41
|
+
return AppSchema.parse(await postItemWithAuthorization(new URL(AppResources.buildPath(), instance.config.host), instance.authorizer, InsertAppPayloadSchema.parse));
|
|
42
42
|
}
|
|
43
43
|
export async function updateApp(instance, id, item) {
|
|
44
|
-
return AppSchema.parse(await
|
|
44
|
+
return AppSchema.parse(await patchItemWithAuthorization(new URL(AppResources.buildPath(id), instance.config.host), instance.authorizer, UpdateAppPayloadSchema.parse(item)));
|
|
45
45
|
}
|
|
46
46
|
export async function deleteApp(instance, id) {
|
|
47
47
|
return AppSchema.parse(await deleteItemWithAuthorization(new URL(AppResources.buildPath(id), instance.config.host), instance.authorizer));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deleteItemWithAuthorization, getItemWithAuthorization,
|
|
1
|
+
import { deleteItemWithAuthorization, getItemWithAuthorization, patchItemWithAuthorization, postItemWithAuthorization, } from '../../common/resources/operations.js';
|
|
2
2
|
import { PATH } from '../resources.js';
|
|
3
3
|
import { InsertSAMLPayloadSchema, SAMLSchema, UpdateSAMLPayloadSchema, } from './schema.js';
|
|
4
4
|
const RESOURCE = 'saml';
|
|
@@ -30,10 +30,10 @@ export async function getSAML(instance, appId) {
|
|
|
30
30
|
return SAMLSchema.parse(await getItemWithAuthorization(new URL(SAMLResources.buildPath(appId), instance.config.host), instance.authorizer));
|
|
31
31
|
}
|
|
32
32
|
export async function insertSAML(instance, appId, item) {
|
|
33
|
-
return SAMLSchema.parse(await
|
|
33
|
+
return SAMLSchema.parse(await postItemWithAuthorization(new URL(SAMLResources.buildPath(appId), instance.config.host), instance.authorizer, item ? InsertSAMLPayloadSchema.parse(item) : undefined));
|
|
34
34
|
}
|
|
35
35
|
export async function updateSAML(instance, appId, item) {
|
|
36
|
-
return SAMLSchema.parse(await
|
|
36
|
+
return SAMLSchema.parse(await patchItemWithAuthorization(new URL(SAMLResources.buildPath(appId), instance.config.host), instance.authorizer, UpdateSAMLPayloadSchema.parse(item)));
|
|
37
37
|
}
|
|
38
38
|
export async function deleteSAML(instance, appId) {
|
|
39
39
|
return SAMLSchema.parse(await deleteItemWithAuthorization(new URL(SAMLResources.buildPath(appId), instance.config.host), instance.authorizer));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deleteItemWithAuthorization, getItemWithAuthorization,
|
|
1
|
+
import { deleteItemWithAuthorization, getItemWithAuthorization, putItemWithAuthorization, } from '../common/resources/operations.js';
|
|
2
2
|
import { addPaginationToURL } from '../common/resources/utils.js';
|
|
3
3
|
import { PaginationCollectionSchema, } from '../common/schema/collection.js';
|
|
4
4
|
import { appendSearchParams } from '../common/schema/url.js';
|
|
@@ -35,7 +35,7 @@ export async function listAssociations(instance, id, options, pagination) {
|
|
|
35
35
|
return PaginationCollectionSchema(AssociationSchema).parse(await getItemWithAuthorization(url, instance.authorizer));
|
|
36
36
|
}
|
|
37
37
|
export async function upsertAssociation(instance, fromId, toId, item) {
|
|
38
|
-
return AssociationSchema.parse(await
|
|
38
|
+
return AssociationSchema.parse(await putItemWithAuthorization(new URL(AssociationResources.buildPath(fromId, toId), instance.config.host), instance.authorizer, item ? UpsertAssociationPayloadSchema.parse(item) : undefined));
|
|
39
39
|
}
|
|
40
40
|
export async function deleteAssociation(instance, fromId, toId) {
|
|
41
41
|
return AssociationSchema.parse(await deleteItemWithAuthorization(new URL(AssociationResources.buildPath(fromId, toId), instance.config.host), instance.authorizer));
|
|
@@ -5,17 +5,9 @@ export declare const AssociationObjectType: {
|
|
|
5
5
|
readonly ROLE: "Role";
|
|
6
6
|
readonly APP: "App";
|
|
7
7
|
readonly PERMISSION: "Permission";
|
|
8
|
+
readonly SESSION: "Session";
|
|
8
9
|
};
|
|
9
10
|
export type AnyAssociationObjectType = (typeof AssociationObjectType)[keyof typeof AssociationObjectType];
|
|
10
|
-
export declare const AssociationIdReferenceSchema: z.ZodObject<{
|
|
11
|
-
id: z.ZodString;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
export type AssociationIdReference = z.output<typeof AssociationIdReferenceSchema>;
|
|
14
|
-
export declare const AssociationAttributesReferenceSchema: z.ZodIntersection<z.ZodObject<{
|
|
15
|
-
id: z.ZodString;
|
|
16
|
-
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
17
|
-
export type AssociationAttributesReference = z.output<typeof AssociationAttributesReferenceSchema>;
|
|
18
|
-
export type AssociationReference = AssociationIdReference | AssociationAttributesReference;
|
|
19
11
|
export declare const AssociationObjectSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
20
12
|
status: z.ZodDefault<z.ZodEnum<{
|
|
21
13
|
active: "active";
|
|
@@ -59,6 +51,19 @@ export declare const AssociationObjectSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
59
51
|
}>>;
|
|
60
52
|
model: z.ZodLiteral<"Permission">;
|
|
61
53
|
id: z.ZodString;
|
|
54
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
55
|
+
model: z.ZodLiteral<"Session">;
|
|
56
|
+
createdAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodTransform<string, Date>>;
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
status: z.ZodEnum<{
|
|
59
|
+
pending: "pending";
|
|
60
|
+
initiated: "initiated";
|
|
61
|
+
authenticated: "authenticated";
|
|
62
|
+
}>;
|
|
63
|
+
expiresAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodTransform<string, Date>>;
|
|
64
|
+
user: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUndefined]>>;
|
|
65
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
66
|
+
sourceIp: z.ZodOptional<z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6, z.ZodUndefined]>>;
|
|
62
67
|
}, z.core.$strip>]>;
|
|
63
68
|
export type AssociationObject = z.output<typeof AssociationObjectSchema>;
|
|
64
69
|
export declare const ObjectPropertySchema: z.ZodObject<{
|
|
@@ -105,6 +110,19 @@ export declare const ObjectPropertySchema: z.ZodObject<{
|
|
|
105
110
|
}>>;
|
|
106
111
|
model: z.ZodLiteral<"Permission">;
|
|
107
112
|
id: z.ZodString;
|
|
113
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
114
|
+
model: z.ZodLiteral<"Session">;
|
|
115
|
+
createdAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodTransform<string, Date>>;
|
|
116
|
+
id: z.ZodString;
|
|
117
|
+
status: z.ZodEnum<{
|
|
118
|
+
pending: "pending";
|
|
119
|
+
initiated: "initiated";
|
|
120
|
+
authenticated: "authenticated";
|
|
121
|
+
}>;
|
|
122
|
+
expiresAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodTransform<string, Date>>;
|
|
123
|
+
user: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUndefined]>>;
|
|
124
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
125
|
+
sourceIp: z.ZodOptional<z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6, z.ZodUndefined]>>;
|
|
108
126
|
}, z.core.$strip>]>;
|
|
109
127
|
}, z.core.$strip>;
|
|
110
128
|
export declare const AssociationSchema: z.ZodObject<{
|
|
@@ -156,6 +174,19 @@ export declare const AssociationSchema: z.ZodObject<{
|
|
|
156
174
|
}>>;
|
|
157
175
|
model: z.ZodLiteral<"Permission">;
|
|
158
176
|
id: z.ZodString;
|
|
177
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
178
|
+
model: z.ZodLiteral<"Session">;
|
|
179
|
+
createdAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodTransform<string, Date>>;
|
|
180
|
+
id: z.ZodString;
|
|
181
|
+
status: z.ZodEnum<{
|
|
182
|
+
pending: "pending";
|
|
183
|
+
initiated: "initiated";
|
|
184
|
+
authenticated: "authenticated";
|
|
185
|
+
}>;
|
|
186
|
+
expiresAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodTransform<string, Date>>;
|
|
187
|
+
user: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUndefined]>>;
|
|
188
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
189
|
+
sourceIp: z.ZodOptional<z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6, z.ZodUndefined]>>;
|
|
159
190
|
}, z.core.$strip>]>;
|
|
160
191
|
}, z.core.$strip>;
|
|
161
192
|
declare const RootAssociationProperties: z.ZodObject<{
|
|
@@ -229,6 +260,19 @@ export declare const AssociationPayloadSchema: z.ZodObject<{
|
|
|
229
260
|
}>>;
|
|
230
261
|
model: z.ZodLiteral<"Permission">;
|
|
231
262
|
id: z.ZodString;
|
|
263
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
264
|
+
model: z.ZodLiteral<"Session">;
|
|
265
|
+
createdAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodTransform<string, Date>>;
|
|
266
|
+
id: z.ZodString;
|
|
267
|
+
status: z.ZodEnum<{
|
|
268
|
+
pending: "pending";
|
|
269
|
+
initiated: "initiated";
|
|
270
|
+
authenticated: "authenticated";
|
|
271
|
+
}>;
|
|
272
|
+
expiresAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodString, z.ZodTransform<Date, string>>]>, z.ZodTransform<string, Date>>;
|
|
273
|
+
user: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodUndefined]>>;
|
|
274
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
275
|
+
sourceIp: z.ZodOptional<z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6, z.ZodUndefined]>>;
|
|
232
276
|
}, z.core.$strip>]>;
|
|
233
277
|
}, z.core.$strip>;
|
|
234
278
|
type RootAssociationPayload = z.output<typeof AssociationPayloadSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/association/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/association/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAwB5B,eAAO,MAAM,qBAAqB;;;;;;;CAOxB,CAAC;AACX,MAAM,MAAM,wBAAwB,GAClC,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAErE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAOlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAQzE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAE/B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAO5B,CAAC;AACH,QAAA,MAAM,yBAAyB;;;;;;iBAA2C,CAAC;AAC3E,KAAK,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC3E,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,IAC7C,yBAAyB,GAAG;IAC9B,MAAM,EAAE,CAAC,CAAC;CACX,CAAC;AACF,QAAA,MAAM,eAAe;;;;;;iBAA2C,CAAC;AACjE,KAAK,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,IACrE,eAAe,GAAG;IAChB,MAAM,EAAE,CAAC,CAAC;CACX,CAAC;AAEJ,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOnC,CAAC;AACH,KAAK,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAExE,MAAM,MAAM,kBAAkB,CAC5B,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,IAC7C,sBAAsB,GAAG;IAC3B,MAAM,EAAE,CAAC,CAAC;CACX,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;iBAGzC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,8BAA8B,CACtC,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAC7C,OAAO,8BAA8B,CACtC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as z from 'zod/v4';
|
|
2
2
|
import { AppAssociationReferenceSchema } from '../app/schema.js';
|
|
3
|
+
import { SessionAssociationReferenceSchema } from '../authentication/sessions/schema.js';
|
|
3
4
|
import { PermissionAssociationReferenceSchema, RoleAssociationReferenceSchema, } from '../authorization/index.js';
|
|
4
5
|
import { DeactivatedAtPropertyPayloadSchema, DeactivatedAtPropertySchema, DeletedAtPropertyPayloadSchema, DeletedAtPropertySchema, OptionalDatePayloadSchema, OptionalDateSchema, UpdatedAtPropertyPayloadSchema, UpdatedAtPropertySchema, } from '../common/schema/dates.js';
|
|
5
6
|
import { MetadataMapPropertySchema, MetadataPayloadPropertySchema, } from '../common/schema/metadata.js';
|
|
@@ -11,17 +12,15 @@ export const AssociationObjectType = {
|
|
|
11
12
|
ROLE: 'Role',
|
|
12
13
|
APP: 'App',
|
|
13
14
|
PERMISSION: 'Permission',
|
|
15
|
+
SESSION: 'Session',
|
|
14
16
|
};
|
|
15
|
-
export const AssociationIdReferenceSchema = z.object({
|
|
16
|
-
id: z.string(),
|
|
17
|
-
});
|
|
18
|
-
export const AssociationAttributesReferenceSchema = AssociationIdReferenceSchema.and(z.record(z.string(), z.unknown()));
|
|
19
17
|
export const AssociationObjectSchema = z.union([
|
|
20
18
|
UserAssociationReferenceSchema,
|
|
21
19
|
OrganizationAssociationReferenceSchema,
|
|
22
20
|
AppAssociationReferenceSchema,
|
|
23
21
|
RoleAssociationReferenceSchema,
|
|
24
22
|
PermissionAssociationReferenceSchema,
|
|
23
|
+
SessionAssociationReferenceSchema,
|
|
25
24
|
]);
|
|
26
25
|
// export type AssociationObject =
|
|
27
26
|
// | UserAssociationReference
|
|
@@ -2,7 +2,7 @@ import { describe, expect, test } from 'vitest';
|
|
|
2
2
|
import { generateAppId } from '../app/utils.js';
|
|
3
3
|
import { generatePermissionId, generateRoleId, } from '../authorization/schema.js';
|
|
4
4
|
import { generateUserId } from '../customer/schema.js';
|
|
5
|
-
import {
|
|
5
|
+
import { AssociationObjectSchema, AssociationObjectType } from './schema.js';
|
|
6
6
|
describe('Association - Schema', () => {
|
|
7
7
|
describe('AssociationObjectType constants', () => {
|
|
8
8
|
test('should have correct object type values', () => {
|
|
@@ -11,56 +11,7 @@ describe('Association - Schema', () => {
|
|
|
11
11
|
expect(AssociationObjectType.ROLE).toBe('Role');
|
|
12
12
|
expect(AssociationObjectType.APP).toBe('App');
|
|
13
13
|
expect(AssociationObjectType.PERMISSION).toBe('Permission');
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
describe('AssociationIdReferenceSchema', () => {
|
|
17
|
-
test('should accept valid id reference', () => {
|
|
18
|
-
const reference = { id: 'any_string_id' };
|
|
19
|
-
const result = AssociationIdReferenceSchema.safeParse(reference);
|
|
20
|
-
// Parse succeeds for valid data
|
|
21
|
-
expect(result.success).toBe(true);
|
|
22
|
-
if (result.success) {
|
|
23
|
-
expect(result.data).toEqual(reference);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
test('should reject missing id', () => {
|
|
27
|
-
const result = AssociationIdReferenceSchema.safeParse({});
|
|
28
|
-
expect(result.success).toBe(false);
|
|
29
|
-
});
|
|
30
|
-
test('should reject non-string id', () => {
|
|
31
|
-
const reference = { id: 123 };
|
|
32
|
-
const result = AssociationIdReferenceSchema.safeParse(reference);
|
|
33
|
-
expect(result.success).toBe(false);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
describe('AssociationAttributesReferenceSchema', () => {
|
|
37
|
-
test('should accept id with additional attributes', () => {
|
|
38
|
-
const reference = {
|
|
39
|
-
id: 'test_id',
|
|
40
|
-
name: 'Test Name',
|
|
41
|
-
status: 'active',
|
|
42
|
-
metadata: { key: 'value' },
|
|
43
|
-
};
|
|
44
|
-
const result = AssociationAttributesReferenceSchema.safeParse(reference);
|
|
45
|
-
// Parse succeeds for valid data
|
|
46
|
-
expect(result.success).toBe(true);
|
|
47
|
-
if (result.success) {
|
|
48
|
-
expect(result.data).toEqual(reference);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
test('should accept minimal reference with just id', () => {
|
|
52
|
-
const reference = { id: 'minimal_id' };
|
|
53
|
-
const result = AssociationAttributesReferenceSchema.safeParse(reference);
|
|
54
|
-
// Parse succeeds for valid data
|
|
55
|
-
expect(result.success).toBe(true);
|
|
56
|
-
if (result.success) {
|
|
57
|
-
expect(result.data).toEqual(reference);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
test('should reject missing id', () => {
|
|
61
|
-
const reference = { name: 'Test', status: 'active' };
|
|
62
|
-
const result = AssociationAttributesReferenceSchema.safeParse(reference);
|
|
63
|
-
expect(result.success).toBe(false);
|
|
14
|
+
expect(AssociationObjectType.SESSION).toBe('Session');
|
|
64
15
|
});
|
|
65
16
|
});
|
|
66
17
|
describe('AssociationObjectSchema', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getItemWithAuthorization,
|
|
1
|
+
import { getItemWithAuthorization, postItemWithAuthorization, } from '../../common/resources/operations.js';
|
|
2
2
|
import { PATH } from '../resources.js';
|
|
3
3
|
import { SettingsSchema, UpsertSettingsPayloadSchema, } from './schema.js';
|
|
4
4
|
const RESOURCE = 'settings';
|
|
@@ -21,5 +21,5 @@ export async function getSettings(instance) {
|
|
|
21
21
|
return SettingsSchema.parse(await getItemWithAuthorization(new URL(SettingsResources.buildPath(), instance.config.host), instance.authorizer));
|
|
22
22
|
}
|
|
23
23
|
export async function upsertSettings(instance, item) {
|
|
24
|
-
return SettingsSchema.parse(await
|
|
24
|
+
return SettingsSchema.parse(await postItemWithAuthorization(new URL(SettingsResources.buildPath(), instance.config.host), instance.authorizer, UpsertSettingsPayloadSchema.parse(item)));
|
|
25
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deleteItemWithAuthorization, getItemWithAuthorization,
|
|
1
|
+
import { deleteItemWithAuthorization, getItemWithAuthorization, patchItemWithAuthorization, postItemWithAuthorization, } from '../../common/resources/operations.js';
|
|
2
2
|
import { addPaginationToURL } from '../../common/resources/utils.js';
|
|
3
3
|
import { PaginationCollectionSchema, } from '../../common/schema/collection.js';
|
|
4
4
|
import { PATH } from '../resources.js';
|
|
@@ -39,10 +39,10 @@ export async function getStrategy(instance, id) {
|
|
|
39
39
|
return StrategySchema.parse(await getItemWithAuthorization(new URL(StrategyResources.buildItemPath(id), instance.config.host), instance.authorizer));
|
|
40
40
|
}
|
|
41
41
|
export async function insertStrategy(instance, item) {
|
|
42
|
-
return StrategySchema.parse(await
|
|
42
|
+
return StrategySchema.parse(await postItemWithAuthorization(new URL(StrategyResources.buildPath(), instance.config.host), instance.authorizer, InsertStrategyPayloadSchema.parse(item)));
|
|
43
43
|
}
|
|
44
44
|
export async function updateStrategy(instance, id, item) {
|
|
45
|
-
return StrategySchema.parse(await
|
|
45
|
+
return StrategySchema.parse(await patchItemWithAuthorization(new URL(StrategyResources.buildItemPath(id), instance.config.host), instance.authorizer, UpdateStrategyPayloadSchema.parse(item)));
|
|
46
46
|
}
|
|
47
47
|
export async function deleteStrategy(instance, id) {
|
|
48
48
|
return StrategySchema.parse(await deleteItemWithAuthorization(new URL(StrategyResources.buildItemPath(id), instance.config.host), instance.authorizer));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deleteItemWithAuthorization, getItemWithAuthorization,
|
|
1
|
+
import { deleteItemWithAuthorization, getItemWithAuthorization, patchItemWithAuthorization, postItemWithAuthorization, } from '../../common/resources/operations.js';
|
|
2
2
|
import { addPaginationToURL } from '../../common/resources/utils.js';
|
|
3
3
|
import { PaginationCollectionSchema, } from '../../common/schema/collection.js';
|
|
4
4
|
import { InsertPermissionPayloadSchema, PermissionSchema, UpdatePermissionPayloadSchema, } from './schema.js';
|
|
@@ -38,10 +38,10 @@ export async function getPermission(instance, id) {
|
|
|
38
38
|
return PermissionSchema.parse(await getItemWithAuthorization(new URL(PermissionResources.buildPath(id), instance.config.host), instance.authorizer));
|
|
39
39
|
}
|
|
40
40
|
export async function insertPermission(instance, item) {
|
|
41
|
-
return PermissionSchema.parse(await
|
|
41
|
+
return PermissionSchema.parse(await postItemWithAuthorization(new URL(PermissionResources.buildPath(), instance.config.host), instance.authorizer, InsertPermissionPayloadSchema.parse(item)));
|
|
42
42
|
}
|
|
43
43
|
export async function updatePermission(instance, id, item) {
|
|
44
|
-
return PermissionSchema.parse(await
|
|
44
|
+
return PermissionSchema.parse(await patchItemWithAuthorization(new URL(PermissionResources.buildPath(id), instance.config.host), instance.authorizer, UpdatePermissionPayloadSchema.parse(item)));
|
|
45
45
|
}
|
|
46
46
|
export async function deletePermission(instance, id) {
|
|
47
47
|
return PermissionSchema.parse(await deleteItemWithAuthorization(new URL(PermissionResources.buildPath(id), instance.config.host), instance.authorizer));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deleteItemWithAuthorization, getItemWithAuthorization,
|
|
1
|
+
import { deleteItemWithAuthorization, getItemWithAuthorization, patchItemWithAuthorization, postItemWithAuthorization, } from '../../common/resources/operations.js';
|
|
2
2
|
import { addPaginationToURL } from '../../common/resources/utils.js';
|
|
3
3
|
import { PaginationCollectionSchema, } from '../../common/schema/collection.js';
|
|
4
4
|
import { InsertRolePayloadSchema, RoleSchema, UpdateRolePayloadSchema, } from './schema.js';
|
|
@@ -38,10 +38,10 @@ export async function getRole(instance, id) {
|
|
|
38
38
|
return RoleSchema.parse(await getItemWithAuthorization(new URL(RoleResources.buildPath(id), instance.config.host), instance.authorizer));
|
|
39
39
|
}
|
|
40
40
|
export async function insertRole(instance, item) {
|
|
41
|
-
return RoleSchema.parse(await
|
|
41
|
+
return RoleSchema.parse(await postItemWithAuthorization(new URL(RoleResources.buildPath(), instance.config.host), instance.authorizer, InsertRolePayloadSchema.parse(item)));
|
|
42
42
|
}
|
|
43
43
|
export async function updateRole(instance, id, item) {
|
|
44
|
-
return RoleSchema.parse(await
|
|
44
|
+
return RoleSchema.parse(await patchItemWithAuthorization(new URL(RoleResources.buildPath(id), instance.config.host), instance.authorizer, UpdateRolePayloadSchema.parse(item)));
|
|
45
45
|
}
|
|
46
46
|
export async function deleteRole(instance, id) {
|
|
47
47
|
return RoleSchema.parse(await deleteItemWithAuthorization(new URL(RoleResources.buildPath(id), instance.config.host), instance.authorizer));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Authorization } from './authorization.js';
|
|
2
2
|
export declare function listItemsWithAuthorization<Result>(url: URL, authorization: Authorization): Promise<Result>;
|
|
3
3
|
export declare function getItemWithAuthorization<Result>(url: URL, authorization: Authorization): Promise<Result>;
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
4
|
+
export declare function patchItemWithAuthorization<Result, Mutation>(url: URL, authorization: Authorization, item: Mutation): Promise<Result>;
|
|
5
|
+
export declare function putItemWithAuthorization<Result, Mutation>(url: URL, authorization: Authorization, item: Mutation): Promise<Result>;
|
|
6
|
+
export declare function postItemWithAuthorization<Result, Mutation>(url: URL, authorization: Authorization, item?: Mutation): Promise<Result>;
|
|
6
7
|
export declare function deleteItemWithAuthorization<Result>(url: URL, authorization: Authorization): Promise<Result>;
|
|
7
8
|
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../src/common/resources/operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AASxD,wBAAsB,0BAA0B,CAAC,MAAM,EACrD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAED,wBAAsB,wBAAwB,CAAC,MAAM,EACnD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAED,wBAAsB,
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../../src/common/resources/operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AASxD,wBAAsB,0BAA0B,CAAC,MAAM,EACrD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAED,wBAAsB,wBAAwB,CAAC,MAAM,EACnD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAED,wBAAsB,0BAA0B,CAAC,MAAM,EAAE,QAAQ,EAC/D,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,QAAQ,EAC7D,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,MAAM,CAAC,CAEjB;AA8BD,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAC9D,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,IAAI,CAAC,EAAE,QAAQ,GACd,OAAO,CAAC,MAAM,CAAC,CAqBjB;AAED,wBAAsB,2BAA2B,CAAC,MAAM,EACtD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,MAAM,CAAC,CAoBjB"}
|
|
@@ -17,7 +17,7 @@ export async function listItemsWithAuthorization(url, authorization) {
|
|
|
17
17
|
}
|
|
18
18
|
export async function getItemWithAuthorization(url, authorization) {
|
|
19
19
|
try {
|
|
20
|
-
console.debug('
|
|
20
|
+
console.debug('GET item', { url });
|
|
21
21
|
const response = await fetch(url, authorization({
|
|
22
22
|
method: 'GET',
|
|
23
23
|
headers: defaultRequestHeaders(),
|
|
@@ -31,11 +31,17 @@ export async function getItemWithAuthorization(url, authorization) {
|
|
|
31
31
|
throw toHttpError(error);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
export async function
|
|
34
|
+
export async function patchItemWithAuthorization(url, authorization, item) {
|
|
35
|
+
return mutateItemWithAuthorization('PATCH', url, authorization, item);
|
|
36
|
+
}
|
|
37
|
+
export async function putItemWithAuthorization(url, authorization, item) {
|
|
38
|
+
return mutateItemWithAuthorization('PUT', url, authorization, item);
|
|
39
|
+
}
|
|
40
|
+
async function mutateItemWithAuthorization(method, url, authorization, item) {
|
|
35
41
|
try {
|
|
36
|
-
console.debug(
|
|
42
|
+
console.debug(`${method} item`, { url, item });
|
|
37
43
|
const response = await fetch(url, authorization({
|
|
38
|
-
method
|
|
44
|
+
method,
|
|
39
45
|
headers: defaultMutationRequestHeaders(),
|
|
40
46
|
body: JSON.stringify(item),
|
|
41
47
|
}));
|
|
@@ -48,9 +54,9 @@ export async function updateItemWithAuthorization(url, authorization, item) {
|
|
|
48
54
|
throw toHttpError(error);
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
|
-
export async function
|
|
57
|
+
export async function postItemWithAuthorization(url, authorization, item) {
|
|
52
58
|
try {
|
|
53
|
-
console.debug('
|
|
59
|
+
console.debug('POST item', { url, item });
|
|
54
60
|
const response = await fetch(url, authorization({
|
|
55
61
|
method: 'POST',
|
|
56
62
|
headers: defaultMutationRequestHeaders(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, test, vi, } from 'vitest';
|
|
2
2
|
import { HttpError } from '../errors/http.js';
|
|
3
3
|
import { ValidationError } from '../errors/validation.js';
|
|
4
|
-
import { deleteItemWithAuthorization, getItemWithAuthorization,
|
|
4
|
+
import { deleteItemWithAuthorization, getItemWithAuthorization, listItemsWithAuthorization, postItemWithAuthorization, putItemWithAuthorization, } from './operations.js';
|
|
5
5
|
// Mock console.debug to avoid noise in tests
|
|
6
6
|
global.console.debug = vi.fn();
|
|
7
7
|
// Mock fetch globally
|
|
@@ -111,7 +111,7 @@ describe('Common Resources - Operations', () => {
|
|
|
111
111
|
json: () => Promise.resolve({}),
|
|
112
112
|
});
|
|
113
113
|
await getItemWithAuthorization(testUrl, mockAuthorization);
|
|
114
|
-
expect(console.debug).toHaveBeenCalledWith('
|
|
114
|
+
expect(console.debug).toHaveBeenCalledWith('GET item', { url: testUrl });
|
|
115
115
|
});
|
|
116
116
|
});
|
|
117
117
|
describe('updateItemWithAuthorization', () => {
|
|
@@ -122,7 +122,7 @@ describe('Common Resources - Operations', () => {
|
|
|
122
122
|
ok: true,
|
|
123
123
|
json: () => Promise.resolve(responseData),
|
|
124
124
|
});
|
|
125
|
-
const result = await
|
|
125
|
+
const result = await putItemWithAuthorization(testUrl, mockAuthorization, updateData);
|
|
126
126
|
expect(result).toEqual(responseData);
|
|
127
127
|
expect(mockFetch).toHaveBeenCalledWith(testUrl, expect.objectContaining({
|
|
128
128
|
method: 'PUT',
|
|
@@ -136,7 +136,7 @@ describe('Common Resources - Operations', () => {
|
|
|
136
136
|
ok: true,
|
|
137
137
|
json: () => Promise.resolve({}),
|
|
138
138
|
});
|
|
139
|
-
await
|
|
139
|
+
await putItemWithAuthorization(testUrl, mockAuthorization, updateData);
|
|
140
140
|
const authCall = mockAuthorization.mock.calls[0][0];
|
|
141
141
|
const headers = authCall.headers;
|
|
142
142
|
expect(headers.get('accept')).toBe('application/json');
|
|
@@ -152,7 +152,7 @@ describe('Common Resources - Operations', () => {
|
|
|
152
152
|
fields: { name: ['required'] },
|
|
153
153
|
}),
|
|
154
154
|
});
|
|
155
|
-
await expect(
|
|
155
|
+
await expect(putItemWithAuthorization(testUrl, mockAuthorization, {})).rejects.toThrow(ValidationError);
|
|
156
156
|
});
|
|
157
157
|
test('should log debug information with item data', async () => {
|
|
158
158
|
const updateData = { name: 'Test Item' };
|
|
@@ -160,8 +160,8 @@ describe('Common Resources - Operations', () => {
|
|
|
160
160
|
ok: true,
|
|
161
161
|
json: () => Promise.resolve({}),
|
|
162
162
|
});
|
|
163
|
-
await
|
|
164
|
-
expect(console.debug).toHaveBeenCalledWith('
|
|
163
|
+
await putItemWithAuthorization(testUrl, mockAuthorization, updateData);
|
|
164
|
+
expect(console.debug).toHaveBeenCalledWith('PUT item', {
|
|
165
165
|
url: testUrl,
|
|
166
166
|
item: updateData,
|
|
167
167
|
});
|
|
@@ -175,7 +175,7 @@ describe('Common Resources - Operations', () => {
|
|
|
175
175
|
ok: true,
|
|
176
176
|
json: () => Promise.resolve(responseData),
|
|
177
177
|
});
|
|
178
|
-
const result = await
|
|
178
|
+
const result = await postItemWithAuthorization(testUrl, mockAuthorization, insertData);
|
|
179
179
|
expect(result).toEqual(responseData);
|
|
180
180
|
expect(mockFetch).toHaveBeenCalledWith(testUrl, expect.objectContaining({
|
|
181
181
|
method: 'POST',
|
|
@@ -189,7 +189,7 @@ describe('Common Resources - Operations', () => {
|
|
|
189
189
|
ok: true,
|
|
190
190
|
json: () => Promise.resolve(responseData),
|
|
191
191
|
});
|
|
192
|
-
const result = await
|
|
192
|
+
const result = await postItemWithAuthorization(testUrl, mockAuthorization);
|
|
193
193
|
expect(result).toEqual(responseData);
|
|
194
194
|
expect(mockFetch).toHaveBeenCalledWith(testUrl, expect.objectContaining({
|
|
195
195
|
method: 'POST',
|
|
@@ -203,7 +203,7 @@ describe('Common Resources - Operations', () => {
|
|
|
203
203
|
ok: true,
|
|
204
204
|
json: () => Promise.resolve(responseData),
|
|
205
205
|
});
|
|
206
|
-
const result = await
|
|
206
|
+
const result = await postItemWithAuthorization(testUrl, mockAuthorization, null);
|
|
207
207
|
expect(result).toEqual(responseData);
|
|
208
208
|
expect(mockFetch).toHaveBeenCalledWith(testUrl, expect.objectContaining({
|
|
209
209
|
method: 'POST',
|
|
@@ -219,7 +219,7 @@ describe('Common Resources - Operations', () => {
|
|
|
219
219
|
error_description: 'Internal server error',
|
|
220
220
|
}),
|
|
221
221
|
});
|
|
222
|
-
await expect(
|
|
222
|
+
await expect(postItemWithAuthorization(testUrl, mockAuthorization, {})).rejects.toThrow(HttpError);
|
|
223
223
|
});
|
|
224
224
|
test('should log debug information', async () => {
|
|
225
225
|
const insertData = { name: 'Test' };
|
|
@@ -227,8 +227,8 @@ describe('Common Resources - Operations', () => {
|
|
|
227
227
|
ok: true,
|
|
228
228
|
json: () => Promise.resolve({}),
|
|
229
229
|
});
|
|
230
|
-
await
|
|
231
|
-
expect(console.debug).toHaveBeenCalledWith('
|
|
230
|
+
await postItemWithAuthorization(testUrl, mockAuthorization, insertData);
|
|
231
|
+
expect(console.debug).toHaveBeenCalledWith('POST item', {
|
|
232
232
|
url: testUrl,
|
|
233
233
|
item: insertData,
|
|
234
234
|
});
|
|
@@ -294,8 +294,8 @@ describe('Common Resources - Operations', () => {
|
|
|
294
294
|
const operations = [
|
|
295
295
|
() => listItemsWithAuthorization(testUrl, mockAuthorization),
|
|
296
296
|
() => getItemWithAuthorization(testUrl, mockAuthorization),
|
|
297
|
-
() =>
|
|
298
|
-
() =>
|
|
297
|
+
() => putItemWithAuthorization(testUrl, mockAuthorization, {}),
|
|
298
|
+
() => postItemWithAuthorization(testUrl, mockAuthorization, {}),
|
|
299
299
|
() => deleteItemWithAuthorization(testUrl, mockAuthorization),
|
|
300
300
|
];
|
|
301
301
|
// Mock successful responses for all operations
|
|
@@ -348,7 +348,7 @@ describe('Common Resources - Operations', () => {
|
|
|
348
348
|
status: 400,
|
|
349
349
|
json: () => Promise.resolve({}),
|
|
350
350
|
});
|
|
351
|
-
await expect(
|
|
351
|
+
await expect(putItemWithAuthorization(testUrl, mockAuthorization, {})).rejects.toThrow(HttpError);
|
|
352
352
|
});
|
|
353
353
|
});
|
|
354
354
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deleteItemWithAuthorization, getItemWithAuthorization,
|
|
1
|
+
import { deleteItemWithAuthorization, getItemWithAuthorization, listItemsWithAuthorization, patchItemWithAuthorization, postItemWithAuthorization, } from '../../common/resources/operations.js';
|
|
2
2
|
import { addPaginationToURL } from '../../common/resources/utils.js';
|
|
3
3
|
import { PaginationCollectionSchema, } from '../../common/schema/collection.js';
|
|
4
4
|
import { InsertUserPayloadSchema, UpdateUserPayloadSchema, UserSchema, } from './schema.js';
|
|
@@ -38,10 +38,10 @@ export async function getUser(instance, id) {
|
|
|
38
38
|
return UserSchema.parse(await getItemWithAuthorization(new URL(UserResources.buildPath(id), instance.config.host), instance.authorizer));
|
|
39
39
|
}
|
|
40
40
|
export async function insertUser(instance, item) {
|
|
41
|
-
return UserSchema.parse(await
|
|
41
|
+
return UserSchema.parse(await postItemWithAuthorization(new URL(UserResources.buildPath(), instance.config.host), instance.authorizer, InsertUserPayloadSchema.parse(item)));
|
|
42
42
|
}
|
|
43
43
|
export async function updateUser(instance, id, item) {
|
|
44
|
-
return UserSchema.parse(await
|
|
44
|
+
return UserSchema.parse(await patchItemWithAuthorization(new URL(UserResources.buildPath(id), instance.config.host), instance.authorizer, UpdateUserPayloadSchema.parse(item)));
|
|
45
45
|
}
|
|
46
46
|
export async function deleteUser(instance, id) {
|
|
47
47
|
return UserSchema.parse(await deleteItemWithAuthorization(new URL(UserResources.buildPath(id), instance.config.host), instance.authorizer));
|