@oblax/identity 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/addresses.d.ts +52 -0
  2. package/dist/addresses.d.ts.map +1 -0
  3. package/dist/addresses.js +94 -0
  4. package/dist/addresses.js.map +1 -0
  5. package/dist/bank-accounts.d.ts +33 -0
  6. package/dist/bank-accounts.d.ts.map +1 -0
  7. package/dist/bank-accounts.js +53 -0
  8. package/dist/bank-accounts.js.map +1 -0
  9. package/dist/contact-methods.d.ts +41 -0
  10. package/dist/contact-methods.d.ts.map +1 -0
  11. package/dist/contact-methods.js +75 -0
  12. package/dist/contact-methods.js.map +1 -0
  13. package/dist/identity-module.d.ts +45 -0
  14. package/dist/identity-module.d.ts.map +1 -0
  15. package/dist/identity-module.js +43 -0
  16. package/dist/identity-module.js.map +1 -0
  17. package/dist/index.d.ts +51 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +55 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/organization-people.d.ts +26 -0
  22. package/dist/organization-people.d.ts.map +1 -0
  23. package/dist/organization-people.js +31 -0
  24. package/dist/organization-people.js.map +1 -0
  25. package/dist/organizations.d.ts +60 -0
  26. package/dist/organizations.d.ts.map +1 -0
  27. package/dist/organizations.js +144 -0
  28. package/dist/organizations.js.map +1 -0
  29. package/dist/people.d.ts +68 -0
  30. package/dist/people.d.ts.map +1 -0
  31. package/dist/people.js +126 -0
  32. package/dist/people.js.map +1 -0
  33. package/dist/person-organizations.d.ts +26 -0
  34. package/dist/person-organizations.d.ts.map +1 -0
  35. package/dist/person-organizations.js +31 -0
  36. package/dist/person-organizations.js.map +1 -0
  37. package/dist/person-roles.d.ts +39 -0
  38. package/dist/person-roles.d.ts.map +1 -0
  39. package/dist/person-roles.js +48 -0
  40. package/dist/person-roles.js.map +1 -0
  41. package/dist/preferences.d.ts +34 -0
  42. package/dist/preferences.d.ts.map +1 -0
  43. package/dist/preferences.js +68 -0
  44. package/dist/preferences.js.map +1 -0
  45. package/dist/types.d.ts +339 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/types.js +3 -0
  48. package/dist/types.js.map +1 -0
  49. package/package.json +51 -0
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Manages the people linked to an organization.
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * await oblax.identity.organizations.people.link({
7
+ * organizationId: 'org-id',
8
+ * personId: 'person-id',
9
+ * })
10
+ *
11
+ * const people = await oblax.identity.organizations.people.list({ organizationId: 'org-id' })
12
+ * ```
13
+ */
14
+ export class OrganizationPeopleSubmodule {
15
+ constructor(ctx) {
16
+ this.ctx = ctx;
17
+ }
18
+ /** Links an organization to a person. */
19
+ async link(params) {
20
+ return this.ctx.http.post(`/identity/organizations/${params.organizationId}/people`, { person_id: params.personId });
21
+ }
22
+ /** Returns all people linked to the organization. */
23
+ async list(params) {
24
+ return this.ctx.http.get(`/identity/organizations/${params.organizationId}/people`);
25
+ }
26
+ /** Fetches a single organization-person link. */
27
+ async get(params) {
28
+ return this.ctx.http.get(`/identity/organizations/${params.organizationId}/people/${params.personId}`);
29
+ }
30
+ }
31
+ //# sourceMappingURL=organization-people.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization-people.js","sourceRoot":"","sources":["../src/organization-people.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,2BAA2B;IACtC,YAA6B,GAAiB;QAAjB,QAAG,GAAH,GAAG,CAAc;IAAG,CAAC;IAElD,yCAAyC;IACzC,KAAK,CAAC,IAAI,CAAC,MAAoC;QAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CACvB,2BAA2B,MAAM,CAAC,cAAc,SAAS,EACzD,EAAE,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE,CAC/B,CAAA;IACH,CAAC;IAED,qDAAqD;IACrD,KAAK,CAAC,IAAI,CAAC,MAAqC;QAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CACtB,2BAA2B,MAAM,CAAC,cAAc,SAAS,CAC1D,CAAA;IACH,CAAC;IAED,iDAAiD;IACjD,KAAK,CAAC,GAAG,CAAC,MAAkC;QAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CACtB,2BAA2B,MAAM,CAAC,cAAc,WAAW,MAAM,CAAC,QAAQ,EAAE,CAC7E,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,60 @@
1
+ import type { OblaxContext } from '@oblax/core';
2
+ import type { CreateOrganizationParams, Organization, OrganizationIdParams, OrganizationOnboardParams, UpdateOrganizationParams } from './types.js';
3
+ import { AddressesSubmodule } from './addresses.js';
4
+ import { ContactMethodsSubmodule } from './contact-methods.js';
5
+ import { PreferencesSubmodule } from './preferences.js';
6
+ import { BankAccountsSubmodule } from './bank-accounts.js';
7
+ import { OrganizationPeopleSubmodule } from './organization-people.js';
8
+ /**
9
+ * Manages organizations in the identity service.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const org = await oblax.identity.organizations.create({
14
+ * name: 'Acme',
15
+ * legalName: 'Acme Inc.',
16
+ * })
17
+ *
18
+ * const full = await oblax.identity.organizations.getFull({ id: org.id })
19
+ *
20
+ * await oblax.identity.organizations.bankAccounts.create({
21
+ * organizationId: org.id,
22
+ * accountNumber: '123456789',
23
+ * bic: 'BOFAUS3N',
24
+ * iban: 'GB82WEST12345698765432',
25
+ * currency: 'USD',
26
+ * })
27
+ * ```
28
+ */
29
+ export declare class OrganizationsSubmodule {
30
+ private readonly ctx;
31
+ /** Manages addresses for an organization. */
32
+ readonly addresses: AddressesSubmodule<'organization'>;
33
+ /** Manages contact methods for an organization. */
34
+ readonly contactMethods: ContactMethodsSubmodule<'organization'>;
35
+ /** Manages preferences for an organization. */
36
+ readonly preferences: PreferencesSubmodule<'organization'>;
37
+ /** Manages bank accounts for an organization. */
38
+ readonly bankAccounts: BankAccountsSubmodule;
39
+ /** Manages people linked to an organization. */
40
+ readonly people: OrganizationPeopleSubmodule;
41
+ constructor(ctx: OblaxContext);
42
+ /** Creates a new organization. */
43
+ create(params: CreateOrganizationParams): Promise<Organization>;
44
+ /**
45
+ * Onboards an organization together with nested addresses, contact methods,
46
+ * preferences and bank accounts in a single call.
47
+ */
48
+ onboard(params: OrganizationOnboardParams): Promise<Organization>;
49
+ /** Returns all organizations. */
50
+ list(): Promise<Organization[]>;
51
+ /** Fetches a single organization by ID. */
52
+ get(params: OrganizationIdParams): Promise<Organization>;
53
+ /** Fetches an organization together with all nested resources. */
54
+ getFull(params: OrganizationIdParams): Promise<Organization>;
55
+ /** Updates an organization. Returns `void` (HTTP 204). */
56
+ update(params: UpdateOrganizationParams): Promise<void>;
57
+ /** Deletes an organization and all nested resources. Returns `void` (HTTP 204). */
58
+ delete(params: OrganizationIdParams): Promise<void>;
59
+ }
60
+ //# sourceMappingURL=organizations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../src/organizations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EACV,wBAAwB,EACxB,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AA+GtE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,sBAAsB;IAYrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAXhC,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAA;IACtD,mDAAmD;IACnD,QAAQ,CAAC,cAAc,EAAE,uBAAuB,CAAC,cAAc,CAAC,CAAA;IAChE,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC,cAAc,CAAC,CAAA;IAC1D,iDAAiD;IACjD,QAAQ,CAAC,YAAY,EAAE,qBAAqB,CAAA;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAA;gBAEf,GAAG,EAAE,YAAY;IAQ9C,kCAAkC;IAC5B,MAAM,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIrE;;;OAGG;IACG,OAAO,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,YAAY,CAAC;IAOvE,iCAAiC;IAC3B,IAAI,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAIrC,2CAA2C;IACrC,GAAG,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC;IAI9D,kEAAkE;IAC5D,OAAO,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIlE,0DAA0D;IACpD,MAAM,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7D,mFAAmF;IAC7E,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1D"}
@@ -0,0 +1,144 @@
1
+ import { AddressesSubmodule } from './addresses.js';
2
+ import { ContactMethodsSubmodule } from './contact-methods.js';
3
+ import { PreferencesSubmodule } from './preferences.js';
4
+ import { BankAccountsSubmodule } from './bank-accounts.js';
5
+ import { OrganizationPeopleSubmodule } from './organization-people.js';
6
+ function organizationToApi(params) {
7
+ return {
8
+ name: params.name,
9
+ legal_name: params.legalName,
10
+ active: params.active,
11
+ registration_number: params.registrationNumber,
12
+ legal_form: params.legalForm,
13
+ vat_number: params.vatNumber,
14
+ tax_id: params.taxId,
15
+ founded_date: params.foundedDate,
16
+ type: params.type,
17
+ industry: params.industry,
18
+ size: params.size,
19
+ currency: params.currency,
20
+ };
21
+ }
22
+ function addressToApi(input) {
23
+ return {
24
+ label: input.label,
25
+ continent: input.continent,
26
+ country: input.country,
27
+ state: input.state,
28
+ city: input.city,
29
+ region: input.region,
30
+ zipcode: input.zipcode,
31
+ address: input.address,
32
+ address_number: input.addressNumber,
33
+ longitude: input.longitude,
34
+ latitude: input.latitude,
35
+ };
36
+ }
37
+ function contactMethodToApi(input) {
38
+ return {
39
+ contact_type: input.contactType,
40
+ contact_kind: input.contactKind,
41
+ value: input.value,
42
+ };
43
+ }
44
+ function preferenceToApi(input) {
45
+ return {
46
+ key: input.key,
47
+ value: input.value,
48
+ value_type: input.valueType,
49
+ };
50
+ }
51
+ function bankAccountToApi(input) {
52
+ return {
53
+ account_number: input.accountNumber,
54
+ bic: input.bic,
55
+ iban: input.iban,
56
+ currency: input.currency,
57
+ };
58
+ }
59
+ function organizationOnboardToApi(params) {
60
+ return {
61
+ name: params.name,
62
+ legal_name: params.legalName,
63
+ active: params.active,
64
+ registration_number: params.registrationNumber,
65
+ legal_form: params.legalForm,
66
+ vat_number: params.vatNumber,
67
+ tax_id: params.taxId,
68
+ founded_date: params.foundedDate,
69
+ type: params.type,
70
+ industry: params.industry,
71
+ size: params.size,
72
+ currency: params.currency,
73
+ addresses: params.addresses?.map(addressToApi),
74
+ contact_methods: params.contactMethods?.map(contactMethodToApi),
75
+ preferences: params.preferences?.map(preferenceToApi),
76
+ bank_accounts: params.bankAccounts?.map(bankAccountToApi),
77
+ primary_address_id: params.primaryAddressId,
78
+ primary_contact_method_id: params.primaryContactMethodId,
79
+ primary_bank_account_id: params.primaryBankAccountId,
80
+ };
81
+ }
82
+ /**
83
+ * Manages organizations in the identity service.
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * const org = await oblax.identity.organizations.create({
88
+ * name: 'Acme',
89
+ * legalName: 'Acme Inc.',
90
+ * })
91
+ *
92
+ * const full = await oblax.identity.organizations.getFull({ id: org.id })
93
+ *
94
+ * await oblax.identity.organizations.bankAccounts.create({
95
+ * organizationId: org.id,
96
+ * accountNumber: '123456789',
97
+ * bic: 'BOFAUS3N',
98
+ * iban: 'GB82WEST12345698765432',
99
+ * currency: 'USD',
100
+ * })
101
+ * ```
102
+ */
103
+ export class OrganizationsSubmodule {
104
+ constructor(ctx) {
105
+ this.ctx = ctx;
106
+ this.addresses = new AddressesSubmodule(ctx, 'organization');
107
+ this.contactMethods = new ContactMethodsSubmodule(ctx, 'organization');
108
+ this.preferences = new PreferencesSubmodule(ctx, 'organization');
109
+ this.bankAccounts = new BankAccountsSubmodule(ctx);
110
+ this.people = new OrganizationPeopleSubmodule(ctx);
111
+ }
112
+ /** Creates a new organization. */
113
+ async create(params) {
114
+ return this.ctx.http.post('/identity/organizations', organizationToApi(params));
115
+ }
116
+ /**
117
+ * Onboards an organization together with nested addresses, contact methods,
118
+ * preferences and bank accounts in a single call.
119
+ */
120
+ async onboard(params) {
121
+ return this.ctx.http.post('/identity/organizations:onboard', organizationOnboardToApi(params));
122
+ }
123
+ /** Returns all organizations. */
124
+ async list() {
125
+ return this.ctx.http.get('/identity/organizations');
126
+ }
127
+ /** Fetches a single organization by ID. */
128
+ async get(params) {
129
+ return this.ctx.http.get(`/identity/organizations/${params.id}`);
130
+ }
131
+ /** Fetches an organization together with all nested resources. */
132
+ async getFull(params) {
133
+ return this.ctx.http.get(`/identity/organizations/${params.id}:full`);
134
+ }
135
+ /** Updates an organization. Returns `void` (HTTP 204). */
136
+ async update(params) {
137
+ return this.ctx.http.put(`/identity/organizations/${params.id}`, organizationToApi(params));
138
+ }
139
+ /** Deletes an organization and all nested resources. Returns `void` (HTTP 204). */
140
+ async delete(params) {
141
+ return this.ctx.http.delete(`/identity/organizations/${params.id}`);
142
+ }
143
+ }
144
+ //# sourceMappingURL=organizations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.js","sourceRoot":"","sources":["../src/organizations.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AAEtE,SAAS,iBAAiB,CACxB,MAA2D;IAE3D,OAAO;QACL,IAAI,EAAiB,MAAM,CAAC,IAAI;QAChC,UAAU,EAAW,MAAM,CAAC,SAAS;QACrC,MAAM,EAAe,MAAM,CAAC,MAAM;QAClC,mBAAmB,EAAE,MAAM,CAAC,kBAAkB;QAC9C,UAAU,EAAW,MAAM,CAAC,SAAS;QACrC,UAAU,EAAW,MAAM,CAAC,SAAS;QACrC,MAAM,EAAe,MAAM,CAAC,KAAK;QACjC,YAAY,EAAS,MAAM,CAAC,WAAW;QACvC,IAAI,EAAiB,MAAM,CAAC,IAAI;QAChC,QAAQ,EAAa,MAAM,CAAC,QAAQ;QACpC,IAAI,EAAiB,MAAM,CAAC,IAAI;QAChC,QAAQ,EAAa,MAAM,CAAC,QAAQ;KACrC,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAYrB;IACC,OAAO;QACL,KAAK,EAAY,KAAK,CAAC,KAAK;QAC5B,SAAS,EAAQ,KAAK,CAAC,SAAS;QAChC,OAAO,EAAU,KAAK,CAAC,OAAO;QAC9B,KAAK,EAAY,KAAK,CAAC,KAAK;QAC5B,IAAI,EAAa,KAAK,CAAC,IAAI;QAC3B,MAAM,EAAW,KAAK,CAAC,MAAM;QAC7B,OAAO,EAAU,KAAK,CAAC,OAAO;QAC9B,OAAO,EAAU,KAAK,CAAC,OAAO;QAC9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,CAAA;IACH,CAAC;IAED,iCAAiC;IACjC,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAiB,yBAAyB,CAAC,CAAA;IACrE,CAAC;IAED,2CAA2C;IAC3C,KAAK,CAAC,GAAG,CAAC,MAA4B;QACpC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAe,2BAA2B,MAAM,CAAC,EAAE,EAAE,CAAC,CAAA;IAChF,CAAC;IAED,kEAAkE;IAClE,KAAK,CAAC,OAAO,CAAC,MAA4B;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAe,2BAA2B,MAAM,CAAC,EAAE,OAAO,CAAC,CAAA;IACrF,CAAC;IAED,0DAA0D;IAC1D,KAAK,CAAC,MAAM,CAAC,MAAgC;QAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAO,2BAA2B,MAAM,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAA;IACnG,CAAC;IAED,mFAAmF;IACnF,KAAK,CAAC,MAAM,CAAC,MAA4B;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAO,2BAA2B,MAAM,CAAC,EAAE,EAAE,CAAC,CAAA;IAC3E,CAAC;CACF"}
@@ -0,0 +1,68 @@
1
+ import type { OblaxContext } from '@oblax/core';
2
+ import type { CreatePersonParams, Person, PersonIdParams, PersonOnboardParams, UpdatePersonParams } from './types.js';
3
+ import { AddressesSubmodule } from './addresses.js';
4
+ import { ContactMethodsSubmodule } from './contact-methods.js';
5
+ import { PreferencesSubmodule } from './preferences.js';
6
+ import { PersonOrganizationsSubmodule } from './person-organizations.js';
7
+ import { PersonRolesSubmodule } from './person-roles.js';
8
+ /**
9
+ * Manages people (individuals) in the identity service.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const person = await oblax.identity.people.create({
14
+ * firstName: 'Alice',
15
+ * lastName: 'Smith',
16
+ * })
17
+ *
18
+ * const full = await oblax.identity.people.getFull({ id: person.id })
19
+ *
20
+ * await oblax.identity.people.update({
21
+ * id: person.id,
22
+ * firstName: 'Alicia',
23
+ * })
24
+ *
25
+ * await oblax.identity.people.addresses.create({
26
+ * personId: person.id,
27
+ * country: 'US',
28
+ * city: 'New York',
29
+ * zipcode: '10001',
30
+ * address: '5th Avenue',
31
+ * addressNumber: '1',
32
+ * longitude: -74.006,
33
+ * latitude: 40.7128,
34
+ * })
35
+ * ```
36
+ */
37
+ export declare class PeopleSubmodule {
38
+ private readonly ctx;
39
+ /** Manages addresses for a person. */
40
+ readonly addresses: AddressesSubmodule<'person'>;
41
+ /** Manages contact methods for a person. */
42
+ readonly contactMethods: ContactMethodsSubmodule<'person'>;
43
+ /** Manages preferences for a person. */
44
+ readonly preferences: PreferencesSubmodule<'person'>;
45
+ /** Manages organization links for a person. */
46
+ readonly organizations: PersonOrganizationsSubmodule;
47
+ /** Manages identity-scoped roles for a person. */
48
+ readonly roles: PersonRolesSubmodule;
49
+ constructor(ctx: OblaxContext);
50
+ /** Creates a new person. */
51
+ create(params: CreatePersonParams): Promise<Person>;
52
+ /**
53
+ * Onboards a person together with nested addresses, contact methods and
54
+ * preferences in a single call.
55
+ */
56
+ onboard(params: PersonOnboardParams): Promise<Person>;
57
+ /** Returns all people. */
58
+ list(): Promise<Person[]>;
59
+ /** Fetches a single person by ID. */
60
+ get(params: PersonIdParams): Promise<Person>;
61
+ /** Fetches a person together with all nested resources. */
62
+ getFull(params: PersonIdParams): Promise<Person>;
63
+ /** Updates a person. Returns `void` (HTTP 204). */
64
+ update(params: UpdatePersonParams): Promise<void>;
65
+ /** Deletes a person and all nested resources. Returns `void` (HTTP 204). */
66
+ delete(params: PersonIdParams): Promise<void>;
67
+ }
68
+ //# sourceMappingURL=people.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"people.d.ts","sourceRoot":"","sources":["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G,OAAO,CAAC,MAAM,CAAC;IAIlD,2DAA2D;IACrD,OAAO,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAItD,mDAAmD;IAC7C,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD,4EAA4E;IACtE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpD"}
package/dist/people.js ADDED
@@ -0,0 +1,126 @@
1
+ import { AddressesSubmodule } from './addresses.js';
2
+ import { ContactMethodsSubmodule } from './contact-methods.js';
3
+ import { PreferencesSubmodule } from './preferences.js';
4
+ import { PersonOrganizationsSubmodule } from './person-organizations.js';
5
+ import { PersonRolesSubmodule } from './person-roles.js';
6
+ function personToApi(params) {
7
+ return {
8
+ first_name: params.firstName,
9
+ last_name: params.lastName,
10
+ avatar: params.avatar,
11
+ active: params.active,
12
+ };
13
+ }
14
+ function addressToApi(input) {
15
+ return {
16
+ label: input.label,
17
+ continent: input.continent,
18
+ country: input.country,
19
+ state: input.state,
20
+ city: input.city,
21
+ region: input.region,
22
+ zipcode: input.zipcode,
23
+ address: input.address,
24
+ address_number: input.addressNumber,
25
+ longitude: input.longitude,
26
+ latitude: input.latitude,
27
+ };
28
+ }
29
+ function contactMethodToApi(input) {
30
+ return {
31
+ contact_type: input.contactType,
32
+ contact_kind: input.contactKind,
33
+ value: input.value,
34
+ };
35
+ }
36
+ function preferenceToApi(input) {
37
+ return {
38
+ key: input.key,
39
+ value: input.value,
40
+ value_type: input.valueType,
41
+ };
42
+ }
43
+ function personOnboardToApi(params) {
44
+ return {
45
+ first_name: params.firstName,
46
+ last_name: params.lastName,
47
+ avatar: params.avatar,
48
+ active: params.active,
49
+ addresses: params.addresses?.map(addressToApi),
50
+ contact_methods: params.contactMethods?.map(contactMethodToApi),
51
+ preferences: params.preferences?.map(preferenceToApi),
52
+ primary_address_id: params.primaryAddressId,
53
+ primary_contact_method_id: params.primaryContactMethodId,
54
+ };
55
+ }
56
+ /**
57
+ * Manages people (individuals) in the identity service.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const person = await oblax.identity.people.create({
62
+ * firstName: 'Alice',
63
+ * lastName: 'Smith',
64
+ * })
65
+ *
66
+ * const full = await oblax.identity.people.getFull({ id: person.id })
67
+ *
68
+ * await oblax.identity.people.update({
69
+ * id: person.id,
70
+ * firstName: 'Alicia',
71
+ * })
72
+ *
73
+ * await oblax.identity.people.addresses.create({
74
+ * personId: person.id,
75
+ * country: 'US',
76
+ * city: 'New York',
77
+ * zipcode: '10001',
78
+ * address: '5th Avenue',
79
+ * addressNumber: '1',
80
+ * longitude: -74.006,
81
+ * latitude: 40.7128,
82
+ * })
83
+ * ```
84
+ */
85
+ export class PeopleSubmodule {
86
+ constructor(ctx) {
87
+ this.ctx = ctx;
88
+ this.addresses = new AddressesSubmodule(ctx, 'person');
89
+ this.contactMethods = new ContactMethodsSubmodule(ctx, 'person');
90
+ this.preferences = new PreferencesSubmodule(ctx, 'person');
91
+ this.organizations = new PersonOrganizationsSubmodule(ctx);
92
+ this.roles = new PersonRolesSubmodule(ctx);
93
+ }
94
+ /** Creates a new person. */
95
+ async create(params) {
96
+ return this.ctx.http.post('/identity/people', personToApi(params));
97
+ }
98
+ /**
99
+ * Onboards a person together with nested addresses, contact methods and
100
+ * preferences in a single call.
101
+ */
102
+ async onboard(params) {
103
+ return this.ctx.http.post('/identity/people:onboard', personOnboardToApi(params));
104
+ }
105
+ /** Returns all people. */
106
+ async list() {
107
+ return this.ctx.http.get('/identity/people');
108
+ }
109
+ /** Fetches a single person by ID. */
110
+ async get(params) {
111
+ return this.ctx.http.get(`/identity/people/${params.id}`);
112
+ }
113
+ /** Fetches a person together with all nested resources. */
114
+ async getFull(params) {
115
+ return this.ctx.http.get(`/identity/people/${params.id}:full`);
116
+ }
117
+ /** Updates a person. Returns `void` (HTTP 204). */
118
+ async update(params) {
119
+ return this.ctx.http.put(`/identity/people/${params.id}`, personToApi(params));
120
+ }
121
+ /** Deletes a person and all nested resources. Returns `void` (HTTP 204). */
122
+ async delete(params) {
123
+ return this.ctx.http.delete(`/identity/people/${params.id}`);
124
+ }
125
+ }
126
+ //# sourceMappingURL=people.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"people.js","sourceRoot":"","sources":["../src/people.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAExD,SAAS,WAAW,CAAC,MAA+C;IAClE,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,SAAS;QAC5B,SAAS,EAAG,MAAM,CAAC,QAAQ;QAC3B,MAAM,EAAM,MAAM,CAAC,MAAM;QACzB,MAAM,EAAM,MAAM,CAAC,MAAM;KAC1B,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAYrB;IACC,OAAO;QACL,KAAK,EAAY,KAAK,CAAC,KAAK;QAC5B,SAAS,EAAQ,KAAK,CAAC,SAAS;QAChC,OAAO,EAAU,KAAK,CAAC,OAAO;QAC9B,KAAK,EAAY,KAAK,CAAC,KAAK;QAC5B,IAAI,EAAa,KAAK,CAAC,IAAI;QAC3B,MAAM,EAAW,KAAK,CAAC,MAAM;QAC7B,OAAO,EAAU,KAAK,CAAC,OAAO;QAC9B,OAAO,EAAU,KAAK,CAAC,OAAO;QAC9B,cAAc,EAAG,KAAK,CAAC,aAAa;QACpC,SAAS,EAAQ,KAAK,CAAC,SAAS;QAChC,QAAQ,EAAS,KAAK,CAAC,QAAQ;KAChC,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,KAI3B;IACC,OAA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oBAAoB,MAAM,CAAC,EAAE,EAAE,CAAC,CAAA;IACpE,CAAC;CACF"}
@@ -0,0 +1,26 @@
1
+ import type { OblaxContext } from '@oblax/core';
2
+ import type { LinkPersonOrganizationParams, OrganizationPerson, PersonOrganizationIdParams, PersonOrganizationOwnerParams } from './types.js';
3
+ /**
4
+ * Manages the organizations a person is linked to.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * await oblax.identity.people.organizations.link({
9
+ * personId: 'person-id',
10
+ * organizationId: 'org-id',
11
+ * })
12
+ *
13
+ * const orgs = await oblax.identity.people.organizations.list({ personId: 'person-id' })
14
+ * ```
15
+ */
16
+ export declare class PersonOrganizationsSubmodule {
17
+ private readonly ctx;
18
+ constructor(ctx: OblaxContext);
19
+ /** Links a person to an organization. */
20
+ link(params: LinkPersonOrganizationParams): Promise<OrganizationPerson>;
21
+ /** Returns all organizations linked to the person. */
22
+ list(params: PersonOrganizationOwnerParams): Promise<OrganizationPerson[]>;
23
+ /** Fetches a single organization-person link. */
24
+ get(params: PersonOrganizationIdParams): Promise<OrganizationPerson>;
25
+ }
26
+ //# sourceMappingURL=person-organizations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-organizations.d.ts","sourceRoot":"","sources":["../src/person-organizations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;GAYG;AACH,qBAAa,4BAA4B;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,YAAY;IAE9C,yCAAyC;IACnC,IAAI,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAO7E,sDAAsD;IAChD,IAAI,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAMhF,iDAAiD;IAC3C,GAAG,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAK3E"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Manages the organizations a person is linked to.
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * await oblax.identity.people.organizations.link({
7
+ * personId: 'person-id',
8
+ * organizationId: 'org-id',
9
+ * })
10
+ *
11
+ * const orgs = await oblax.identity.people.organizations.list({ personId: 'person-id' })
12
+ * ```
13
+ */
14
+ export class PersonOrganizationsSubmodule {
15
+ constructor(ctx) {
16
+ this.ctx = ctx;
17
+ }
18
+ /** Links a person to an organization. */
19
+ async link(params) {
20
+ return this.ctx.http.post(`/identity/people/${params.personId}/organizations`, { organization_id: params.organizationId });
21
+ }
22
+ /** Returns all organizations linked to the person. */
23
+ async list(params) {
24
+ return this.ctx.http.get(`/identity/people/${params.personId}/organizations`);
25
+ }
26
+ /** Fetches a single organization-person link. */
27
+ async get(params) {
28
+ return this.ctx.http.get(`/identity/people/${params.personId}/organizations/${params.organizationId}`);
29
+ }
30
+ }
31
+ //# sourceMappingURL=person-organizations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-organizations.js","sourceRoot":"","sources":["../src/person-organizations.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,4BAA4B;IACvC,YAA6B,GAAiB;QAAjB,QAAG,GAAH,GAAG,CAAc;IAAG,CAAC;IAElD,yCAAyC;IACzC,KAAK,CAAC,IAAI,CAAC,MAAoC;QAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CACvB,oBAAoB,MAAM,CAAC,QAAQ,gBAAgB,EACnD,EAAE,eAAe,EAAE,MAAM,CAAC,cAAc,EAAE,CAC3C,CAAA;IACH,CAAC;IAED,sDAAsD;IACtD,KAAK,CAAC,IAAI,CAAC,MAAqC;QAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CACtB,oBAAoB,MAAM,CAAC,QAAQ,gBAAgB,CACpD,CAAA;IACH,CAAC;IAED,iDAAiD;IACjD,KAAK,CAAC,GAAG,CAAC,MAAkC;QAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CACtB,oBAAoB,MAAM,CAAC,QAAQ,kBAAkB,MAAM,CAAC,cAAc,EAAE,CAC7E,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,39 @@
1
+ import type { OblaxContext } from '@oblax/core';
2
+ import type { CreatePersonRoleParams, PersonRole, PersonRoleIdParams, PersonRoleOwnerParams, UpdatePersonRoleParams } from './types.js';
3
+ /**
4
+ * Manages identity-scoped roles assigned to a person.
5
+ *
6
+ * The handler resolves the named auth role and its realm automatically,
7
+ * so callers only need to supply the role name.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const role = await oblax.identity.people.roles.add({
12
+ * personId: 'person-id',
13
+ * name: 'user',
14
+ * })
15
+ *
16
+ * await oblax.identity.people.roles.update({
17
+ * personId: 'person-id',
18
+ * roleId: role.id,
19
+ * name: 'manager',
20
+ * })
21
+ *
22
+ * await oblax.identity.people.roles.delete({ personId: 'person-id', roleId: role.id })
23
+ * ```
24
+ */
25
+ export declare class PersonRolesSubmodule {
26
+ private readonly ctx;
27
+ constructor(ctx: OblaxContext);
28
+ /** Assigns a role to a person. */
29
+ add(params: CreatePersonRoleParams): Promise<PersonRole>;
30
+ /** Returns all roles assigned to the person. */
31
+ list(params: PersonRoleOwnerParams): Promise<PersonRole[]>;
32
+ /** Fetches a single role assignment by ID. */
33
+ get(params: PersonRoleIdParams): Promise<PersonRole>;
34
+ /** Updates a role assignment. Returns `void` (HTTP 204). */
35
+ update(params: UpdatePersonRoleParams): Promise<void>;
36
+ /** Removes a role assignment. Returns `void` (HTTP 204). */
37
+ delete(params: PersonRoleIdParams): Promise<void>;
38
+ }
39
+ //# sourceMappingURL=person-roles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-roles.d.ts","sourceRoot":"","sources":["../src/person-roles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EACV,sBAAsB,EACtB,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,YAAY;IAE9C,kCAAkC;IAC5B,GAAG,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC;IAO9D,gDAAgD;IAC1C,IAAI,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAIhE,8CAA8C;IACxC,GAAG,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;IAM1D,4DAA4D;IACtD,MAAM,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAO3D,4DAA4D;IACtD,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;CAKxD"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Manages identity-scoped roles assigned to a person.
3
+ *
4
+ * The handler resolves the named auth role and its realm automatically,
5
+ * so callers only need to supply the role name.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const role = await oblax.identity.people.roles.add({
10
+ * personId: 'person-id',
11
+ * name: 'user',
12
+ * })
13
+ *
14
+ * await oblax.identity.people.roles.update({
15
+ * personId: 'person-id',
16
+ * roleId: role.id,
17
+ * name: 'manager',
18
+ * })
19
+ *
20
+ * await oblax.identity.people.roles.delete({ personId: 'person-id', roleId: role.id })
21
+ * ```
22
+ */
23
+ export class PersonRolesSubmodule {
24
+ constructor(ctx) {
25
+ this.ctx = ctx;
26
+ }
27
+ /** Assigns a role to a person. */
28
+ async add(params) {
29
+ return this.ctx.http.post(`/identity/people/${params.personId}/roles`, { name: params.name });
30
+ }
31
+ /** Returns all roles assigned to the person. */
32
+ async list(params) {
33
+ return this.ctx.http.get(`/identity/people/${params.personId}/roles`);
34
+ }
35
+ /** Fetches a single role assignment by ID. */
36
+ async get(params) {
37
+ return this.ctx.http.get(`/identity/people/${params.personId}/roles/${params.roleId}`);
38
+ }
39
+ /** Updates a role assignment. Returns `void` (HTTP 204). */
40
+ async update(params) {
41
+ return this.ctx.http.put(`/identity/people/${params.personId}/roles/${params.roleId}`, { owner_id: params.personId, name: params.name });
42
+ }
43
+ /** Removes a role assignment. Returns `void` (HTTP 204). */
44
+ async delete(params) {
45
+ return this.ctx.http.delete(`/identity/people/${params.personId}/roles/${params.roleId}`);
46
+ }
47
+ }
48
+ //# sourceMappingURL=person-roles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-roles.js","sourceRoot":"","sources":["../src/person-roles.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,oBAAoB;IAC/B,YAA6B,GAAiB;QAAjB,QAAG,GAAH,GAAG,CAAc;IAAG,CAAC;IAElD,kCAAkC;IAClC,KAAK,CAAC,GAAG,CAAC,MAA8B;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CACvB,oBAAoB,MAAM,CAAC,QAAQ,QAAQ,EAC3C,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CACtB,CAAA;IACH,CAAC;IAED,gDAAgD;IAChD,KAAK,CAAC,IAAI,CAAC,MAA6B;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAe,oBAAoB,MAAM,CAAC,QAAQ,QAAQ,CAAC,CAAA;IACrF,CAAC;IAED,8CAA8C;IAC9C,KAAK,CAAC,GAAG,CAAC,MAA0B;QAClC,OA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