@things-factory/saas 10.1.248 → 10.1.250
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/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +5 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/entity360/saas-account-360.d.ts +11 -0
- package/dist-client/entity360/saas-account-360.js +178 -0
- package/dist-client/entity360/saas-account-360.js.map +1 -0
- package/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/saas-account-list.d.ts +57 -0
- package/dist-client/pages/saas-account-list.js +169 -0
- package/dist-client/pages/saas-account-list.js.map +1 -0
- package/dist-client/pages/saas-account-page.d.ts +52 -0
- package/dist-client/pages/saas-account-page.js +332 -0
- package/dist-client/pages/saas-account-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +13 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/words.d.ts +34 -0
- package/dist-client/words.js +22 -0
- package/dist-client/words.js.map +1 -0
- package/dist-server/index.d.ts +1 -0
- package/dist-server/index.js +9 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/role-tasks.d.ts +2 -0
- package/dist-server/role-tasks.js +18 -0
- package/dist-server/role-tasks.js.map +1 -0
- package/dist-server/service/checks.d.ts +27 -0
- package/dist-server/service/checks.js +70 -0
- package/dist-server/service/checks.js.map +1 -0
- package/dist-server/service/index.d.ts +18 -0
- package/dist-server/service/index.js +34 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/saas-access.d.ts +20 -0
- package/dist-server/service/saas-access.js +36 -0
- package/dist-server/service/saas-access.js.map +1 -0
- package/dist-server/service/saas-account.d.ts +39 -0
- package/dist-server/service/saas-account.js +151 -0
- package/dist-server/service/saas-account.js.map +1 -0
- package/dist-server/service/saas-mutation.d.ts +10 -0
- package/dist-server/service/saas-mutation.js +87 -0
- package/dist-server/service/saas-mutation.js.map +1 -0
- package/dist-server/service/saas-query.d.ts +21 -0
- package/dist-server/service/saas-query.js +168 -0
- package/dist-server/service/saas-query.js.map +1 -0
- package/dist-server/service/saas-rules.d.ts +41 -0
- package/dist-server/service/saas-rules.js +62 -0
- package/dist-server/service/saas-rules.js.map +1 -0
- package/dist-server/service/saas-seat.d.ts +26 -0
- package/dist-server/service/saas-seat.js +110 -0
- package/dist-server/service/saas-seat.js.map +1 -0
- package/dist-server/service/saas-service.d.ts +19 -0
- package/dist-server/service/saas-service.js +223 -0
- package/dist-server/service/saas-service.js.map +1 -0
- package/dist-server/service/saas-subscription.d.ts +45 -0
- package/dist-server/service/saas-subscription.js +174 -0
- package/dist-server/service/saas-subscription.js.map +1 -0
- package/dist-server/service/saas-sync.d.ts +34 -0
- package/dist-server/service/saas-sync.js +106 -0
- package/dist-server/service/saas-sync.js.map +1 -0
- package/dist-server/service/saas-type.d.ts +89 -0
- package/dist-server/service/saas-type.js +338 -0
- package/dist-server/service/saas-type.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.syncSaasLicenses = syncSaasLicenses;
|
|
4
|
+
const organization_1 = require("@things-factory/organization");
|
|
5
|
+
const shell_1 = require("@things-factory/shell");
|
|
6
|
+
const saas_account_1 = require("./saas-account");
|
|
7
|
+
const saas_rules_1 = require("./saas-rules");
|
|
8
|
+
const saas_seat_1 = require("./saas-seat");
|
|
9
|
+
const saas_service_1 = require("./saas-service");
|
|
10
|
+
const saas_subscription_1 = require("./saas-subscription");
|
|
11
|
+
const lower = (value) => String(value ?? '').trim().toLowerCase();
|
|
12
|
+
/** The account a vendor's names are: the one whose identifier is one of them - a tenant id, a sign-in domain, an organization id. */
|
|
13
|
+
async function accountOfVendor(tx, domain, vendorNames) {
|
|
14
|
+
const names = new Set(vendorNames.map(lower).filter(Boolean));
|
|
15
|
+
const accounts = (await tx.getRepository(saas_account_1.SaasAccount).find({ where: { domain: { id: domain.id }, status: saas_rules_1.SaasAccountStatus.ACTIVE } })).filter(one => names.has(lower(one.identifier)));
|
|
16
|
+
if (!accounts.length)
|
|
17
|
+
throw new shell_1.Refusal('saas-sync-account-not-found', { names: [...names].join(', ') }, 'No account has the vendor id or one of its domains as its identifier');
|
|
18
|
+
if (accounts.length > 1)
|
|
19
|
+
throw new shell_1.Refusal('saas-sync-account-ambiguous', { names: accounts.map(one => one.name).join(', ') }, 'Two accounts have the vendor as their identifier');
|
|
20
|
+
return accounts[0];
|
|
21
|
+
}
|
|
22
|
+
async function syncSaasLicenses(tx, domain, user, facts, today) {
|
|
23
|
+
const account = await accountOfVendor(tx, domain, [facts.tenantId, ...(facts.domains ?? [])]);
|
|
24
|
+
if (account.parentId)
|
|
25
|
+
throw new shell_1.Refusal('saas-subscription-on-sub-account', {}, 'An account under another is billed by its parent - subscribe there');
|
|
26
|
+
/* Whose mail a login is: an employee's - the mails on their contact card (organization keeps the work mail there), and their user account's. */
|
|
27
|
+
const employees = await tx.getRepository(organization_1.Employee).find({ where: { domain: { id: domain.id } }, relations: ['user', 'contact'] });
|
|
28
|
+
const byMail = new Map();
|
|
29
|
+
for (const one of employees) {
|
|
30
|
+
const mails = [one.user?.email, ...(one.contact?.items ?? []).filter(item => item?.type === 'email').map(item => item.value)];
|
|
31
|
+
for (const mail of mails)
|
|
32
|
+
if (lower(mail))
|
|
33
|
+
byMail.set(lower(mail), one);
|
|
34
|
+
}
|
|
35
|
+
const employeeOf = (holder) => byMail.get(lower(holder.mail)) ?? byMail.get(lower(holder.login));
|
|
36
|
+
const result = { accountId: account.id, accountName: account.name, subscriptions: 0, created: 0, opened: 0, closed: 0, linked: 0, unmatched: [] };
|
|
37
|
+
const subs = await tx.getRepository(saas_subscription_1.SaasSubscription).find({ where: { domain: { id: domain.id }, account: { id: account.id } } });
|
|
38
|
+
for (const sku of facts.skus) {
|
|
39
|
+
let sub = subs.find(one => one.vendorKey === sku.skuId);
|
|
40
|
+
const holders = facts.users.filter(one => one.skuIds.includes(sku.skuId));
|
|
41
|
+
if (!sub) {
|
|
42
|
+
if (!sku.consumed && !holders.length)
|
|
43
|
+
continue;
|
|
44
|
+
[sub] = await (0, saas_service_1.saveSaasSubscriptions)(tx, domain, user, 'all', account.id, [
|
|
45
|
+
{
|
|
46
|
+
cuFlag: '+',
|
|
47
|
+
name: sku.name,
|
|
48
|
+
billing: saas_rules_1.SaasBilling.SEAT,
|
|
49
|
+
vendorKey: sku.skuId,
|
|
50
|
+
quantity: Math.max(sku.enabled, holders.length, 1),
|
|
51
|
+
startOn: today,
|
|
52
|
+
status: saas_rules_1.SaasSubscriptionStatus.ACTIVE,
|
|
53
|
+
...(sku.renewalOn ? { renewalOn: sku.renewalOn } : {}),
|
|
54
|
+
trial: !!sku.trial
|
|
55
|
+
}
|
|
56
|
+
]);
|
|
57
|
+
result.created++;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
/* The quantity, the renewal day and being a trial are the tenant's facts; the rest stays the person's. */
|
|
61
|
+
const change = {};
|
|
62
|
+
if (sku.enabled > 0 && Number(sub.quantity) !== sku.enabled)
|
|
63
|
+
change.quantity = sku.enabled;
|
|
64
|
+
if (sku.renewalOn && sub.renewalOn !== sku.renewalOn)
|
|
65
|
+
change.renewalOn = sku.renewalOn;
|
|
66
|
+
if (sku.trial !== undefined && sku.trial !== null && !!sub.trial !== !!sku.trial)
|
|
67
|
+
change.trial = !!sku.trial;
|
|
68
|
+
if (Object.keys(change).length)
|
|
69
|
+
await (0, saas_service_1.saveSaasSubscriptions)(tx, domain, user, 'all', account.id, [{ id: sub.id, cuFlag: 'M', ...change }]);
|
|
70
|
+
}
|
|
71
|
+
result.subscriptions++;
|
|
72
|
+
const seats = await tx.getRepository(saas_seat_1.SaasSeat).find({ where: { domain: { id: domain.id }, subscription: { id: sub.id } } });
|
|
73
|
+
const synced = seats.filter(one => one.login);
|
|
74
|
+
/* The first sync does not know since when a seat is held. */
|
|
75
|
+
const since = synced.length ? today : null;
|
|
76
|
+
const open = synced.filter(one => !one.untilOn || one.untilOn > today);
|
|
77
|
+
const now = new Set(holders.map(one => lower(one.login)));
|
|
78
|
+
const patches = [];
|
|
79
|
+
for (const holder of holders) {
|
|
80
|
+
const employee = employeeOf(holder);
|
|
81
|
+
if (!employee)
|
|
82
|
+
result.unmatched.push(holder.login);
|
|
83
|
+
const held = open.find(one => lower(one.login) === lower(holder.login));
|
|
84
|
+
if (held) {
|
|
85
|
+
/* A seat held as a name takes its employee once their mail is known - every sync looks again. */
|
|
86
|
+
if (employee && held.employeeId !== employee.id) {
|
|
87
|
+
patches.push({ id: held.id, cuFlag: 'M', employeeId: employee.id, holder: null });
|
|
88
|
+
result.linked++;
|
|
89
|
+
}
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
patches.push({ cuFlag: '+', login: holder.login, employeeId: employee?.id ?? null, holder: employee ? null : holder.name || holder.login, fromOn: since });
|
|
93
|
+
result.opened++;
|
|
94
|
+
}
|
|
95
|
+
for (const seat of open)
|
|
96
|
+
if (!now.has(lower(seat.login))) {
|
|
97
|
+
patches.push({ id: seat.id, cuFlag: 'M', untilOn: seat.fromOn && seat.fromOn > today ? seat.fromOn : today });
|
|
98
|
+
result.closed++;
|
|
99
|
+
}
|
|
100
|
+
if (patches.length)
|
|
101
|
+
await (0, saas_service_1.saveSaasSeats)(tx, domain, user, 'all', sub.id, patches);
|
|
102
|
+
}
|
|
103
|
+
result.unmatched = [...new Set(result.unmatched)];
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=saas-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saas-sync.js","sourceRoot":"","sources":["../../server/service/saas-sync.ts"],"names":[],"mappings":";;AAmDA,4CA2EC;AA9HD,+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,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;gBAC7G,MAAM,CAAC,MAAM,EAAE,CAAA;YACjB,CAAC;QACH,IAAI,OAAO,CAAC,MAAM;YAAE,MAAM,IAAA,4BAAa,EAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IACnF,CAAC;IACD,MAAM,CAAC,SAAS,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAA;IACjD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { Employee } from '@things-factory/organization'\nimport { Domain, Refusal } from '@things-factory/shell'\nimport { EntityManager, In } from 'typeorm'\n\nimport { SaasAccount } from './saas-account'\nimport { SaasAccountStatus, SaasBilling, SaasSubscriptionStatus } from './saas-rules'\nimport { SaasSeat } from './saas-seat'\nimport { saveSaasSeats, saveSaasSubscriptions } from './saas-service'\nimport { SaasSubscription } from './saas-subscription'\n\n/*\n * Seats as a vendor's tenant says (ADR-0177 개정 2) - what a Microsoft 365 tenant bought and who holds each, read by a\n * scenario (integration-msgraph `msgraph-license-assignments`) and handed here. Only quantities, renewal days, trials and\n * seats change: a plan's name, billing, price and status are a person's.\n */\n\nexport interface LicenseFacts {\n tenantId?: string | null\n domains?: string[] | null\n skus: { skuId: string; name: string; enabled: number; consumed: number; renewalOn?: string | null; trial?: boolean | null }[]\n users: { login: string; mail?: string | null; name?: string | null; enabled?: boolean | null; skuIds: string[] }[]\n}\n\nexport interface LicenseSyncResult {\n accountId: string\n accountName: string\n subscriptions: number\n created: number\n opened: number\n closed: number\n /** Open seats held as names that took their employee. */\n linked: number\n /** Logins no employee's mail matched - held as names. */\n unmatched: string[]\n}\n\nconst lower = (value?: string | null) => String(value ?? '').trim().toLowerCase()\n\n/** The account a vendor's names are: the one whose identifier is one of them - a tenant id, a sign-in domain, an organization id. */\nasync function accountOfVendor(tx: EntityManager, domain: Domain, vendorNames: (string | null | undefined)[]): Promise<SaasAccount> {\n const names = new Set(vendorNames.map(lower).filter(Boolean))\n const accounts = (await tx.getRepository(SaasAccount).find({ where: { domain: { id: domain.id }, status: SaasAccountStatus.ACTIVE } as any })).filter(\n one => names.has(lower(one.identifier))\n )\n if (!accounts.length)\n throw new Refusal('saas-sync-account-not-found', { names: [...names].join(', ') }, 'No account has the vendor id or one of its domains as its identifier')\n if (accounts.length > 1)\n throw new Refusal('saas-sync-account-ambiguous', { names: accounts.map(one => one.name).join(', ') }, 'Two accounts have the vendor as their identifier')\n return accounts[0]\n}\n\nexport async function syncSaasLicenses(tx: EntityManager, domain: Domain, user: any, facts: LicenseFacts, today: string): Promise<LicenseSyncResult> {\n const account = await accountOfVendor(tx, domain, [facts.tenantId, ...(facts.domains ?? [])])\n if (account.parentId) throw new Refusal('saas-subscription-on-sub-account', {}, 'An account under another is billed by its parent - subscribe there')\n\n /* Whose mail a login is: an employee's - the mails on their contact card (organization keeps the work mail there), and their user account's. */\n const employees = await tx.getRepository(Employee).find({ where: { domain: { id: domain.id } } as any, relations: ['user', 'contact'] })\n const byMail = new Map<string, Employee>()\n for (const one of employees) {\n const mails = [one.user?.email, ...((one.contact?.items ?? []) as any[]).filter(item => item?.type === 'email').map(item => item.value)]\n for (const mail of mails) if (lower(mail)) byMail.set(lower(mail), one)\n }\n const employeeOf = (holder: LicenseFacts['users'][number]) => byMail.get(lower(holder.mail)) ?? byMail.get(lower(holder.login))\n\n const result: LicenseSyncResult = { accountId: account.id, accountName: account.name, subscriptions: 0, created: 0, opened: 0, closed: 0, linked: 0, unmatched: [] }\n const subs = await tx.getRepository(SaasSubscription).find({ where: { domain: { id: domain.id }, account: { id: account.id } } as any })\n for (const sku of facts.skus) {\n let sub = subs.find(one => one.vendorKey === sku.skuId)\n const holders = facts.users.filter(one => one.skuIds.includes(sku.skuId))\n if (!sub) {\n if (!sku.consumed && !holders.length) continue\n ;[sub] = await saveSaasSubscriptions(tx, domain, user, 'all', account.id, [\n {\n cuFlag: '+',\n name: sku.name,\n billing: SaasBilling.SEAT,\n vendorKey: sku.skuId,\n quantity: Math.max(sku.enabled, holders.length, 1),\n startOn: today,\n status: SaasSubscriptionStatus.ACTIVE,\n ...(sku.renewalOn ? { renewalOn: sku.renewalOn } : {}),\n trial: !!sku.trial\n }\n ])\n result.created++\n } else {\n /* The quantity, the renewal day and being a trial are the tenant's facts; the rest stays the person's. */\n const change: Record<string, any> = {}\n if (sku.enabled > 0 && Number(sub.quantity) !== sku.enabled) change.quantity = sku.enabled\n if (sku.renewalOn && sub.renewalOn !== sku.renewalOn) change.renewalOn = sku.renewalOn\n if (sku.trial !== undefined && sku.trial !== null && !!sub.trial !== !!sku.trial) change.trial = !!sku.trial\n if (Object.keys(change).length) await saveSaasSubscriptions(tx, domain, user, 'all', account.id, [{ id: sub.id, cuFlag: 'M', ...change }])\n }\n result.subscriptions++\n\n const seats = await tx.getRepository(SaasSeat).find({ where: { domain: { id: domain.id }, subscription: { id: sub.id } } as any })\n const synced = seats.filter(one => one.login)\n /* The first sync does not know since when a seat is held. */\n const since = synced.length ? today : null\n const open = synced.filter(one => !one.untilOn || one.untilOn > today)\n const now = new Set(holders.map(one => lower(one.login)))\n const patches: Record<string, any>[] = []\n for (const holder of holders) {\n const employee = employeeOf(holder)\n if (!employee) result.unmatched.push(holder.login)\n const held = open.find(one => lower(one.login) === lower(holder.login))\n if (held) {\n /* A seat held as a name takes its employee once their mail is known - every sync looks again. */\n if (employee && held.employeeId !== employee.id) {\n patches.push({ id: held.id, cuFlag: 'M', employeeId: employee.id, holder: null })\n result.linked++\n }\n continue\n }\n patches.push({ cuFlag: '+', login: holder.login, employeeId: employee?.id ?? null, holder: employee ? null : holder.name || holder.login, fromOn: since })\n result.opened++\n }\n for (const seat of open)\n if (!now.has(lower(seat.login))) {\n patches.push({ id: seat.id, cuFlag: 'M', untilOn: seat.fromOn && seat.fromOn > today ? seat.fromOn : today })\n result.closed++\n }\n if (patches.length) await saveSaasSeats(tx, domain, user, 'all', sub.id, patches)\n }\n result.unmatched = [...new Set(result.unmatched)]\n return result\n}\n"]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { SaasAccount } from './saas-account';
|
|
2
|
+
import { SaasAccountStatus, SaasBilling, SaasSubscriptionStatus } from './saas-rules';
|
|
3
|
+
export declare class SaasAccountPatch {
|
|
4
|
+
id?: string;
|
|
5
|
+
cuFlag?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
counterpartyId?: string;
|
|
8
|
+
identifier?: string;
|
|
9
|
+
parentId?: string;
|
|
10
|
+
purpose?: string;
|
|
11
|
+
adminIds?: string[];
|
|
12
|
+
billingEmail?: string;
|
|
13
|
+
paymentAccountId?: string;
|
|
14
|
+
currency?: string;
|
|
15
|
+
secretLocation?: string;
|
|
16
|
+
status?: SaasAccountStatus;
|
|
17
|
+
closedOn?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class SaasSubscriptionPatch {
|
|
21
|
+
id?: string;
|
|
22
|
+
cuFlag?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
billing?: SaasBilling;
|
|
25
|
+
quantity?: number;
|
|
26
|
+
unitPrice?: number;
|
|
27
|
+
startOn?: string;
|
|
28
|
+
renewalOn?: string;
|
|
29
|
+
autoRenew?: boolean;
|
|
30
|
+
noticeDays?: number;
|
|
31
|
+
departmentId?: string;
|
|
32
|
+
assetId?: string;
|
|
33
|
+
status?: SaasSubscriptionStatus;
|
|
34
|
+
endedOn?: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare class SaasSeatPatch {
|
|
38
|
+
id?: string;
|
|
39
|
+
cuFlag?: string;
|
|
40
|
+
employeeId?: string;
|
|
41
|
+
holder?: string;
|
|
42
|
+
fromOn?: string;
|
|
43
|
+
untilOn?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare class SaasAccountList {
|
|
47
|
+
items: SaasAccount[];
|
|
48
|
+
total: number;
|
|
49
|
+
}
|
|
50
|
+
export declare class SaasChange {
|
|
51
|
+
subject: string;
|
|
52
|
+
factKind: string;
|
|
53
|
+
field: string;
|
|
54
|
+
fromValue?: string;
|
|
55
|
+
toValue?: string;
|
|
56
|
+
at: Date;
|
|
57
|
+
changedBy?: string;
|
|
58
|
+
}
|
|
59
|
+
export declare class SaasLicenseSkuInput {
|
|
60
|
+
skuId: string;
|
|
61
|
+
name: string;
|
|
62
|
+
enabled: number;
|
|
63
|
+
consumed: number;
|
|
64
|
+
renewalOn?: string;
|
|
65
|
+
trial?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export declare class SaasLicenseUserInput {
|
|
68
|
+
login: string;
|
|
69
|
+
mail?: string;
|
|
70
|
+
name?: string;
|
|
71
|
+
enabled?: boolean;
|
|
72
|
+
skuIds: string[];
|
|
73
|
+
}
|
|
74
|
+
export declare class SaasLicensesInput {
|
|
75
|
+
tenantId?: string;
|
|
76
|
+
domains?: string[];
|
|
77
|
+
skus: SaasLicenseSkuInput[];
|
|
78
|
+
users: SaasLicenseUserInput[];
|
|
79
|
+
}
|
|
80
|
+
export declare class SaasLicenseSync {
|
|
81
|
+
accountId: string;
|
|
82
|
+
accountName: string;
|
|
83
|
+
subscriptions: number;
|
|
84
|
+
created: number;
|
|
85
|
+
opened: number;
|
|
86
|
+
closed: number;
|
|
87
|
+
linked: number;
|
|
88
|
+
unmatched: string[];
|
|
89
|
+
}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SaasLicenseSync = exports.SaasLicensesInput = exports.SaasLicenseUserInput = exports.SaasLicenseSkuInput = exports.SaasChange = exports.SaasAccountList = exports.SaasSeatPatch = exports.SaasSubscriptionPatch = exports.SaasAccountPatch = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const saas_account_1 = require("./saas-account");
|
|
7
|
+
const saas_rules_1 = require("./saas-rules");
|
|
8
|
+
let SaasAccountPatch = class SaasAccountPatch {
|
|
9
|
+
};
|
|
10
|
+
exports.SaasAccountPatch = SaasAccountPatch;
|
|
11
|
+
tslib_1.__decorate([
|
|
12
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The account; empty for a new one' }),
|
|
13
|
+
tslib_1.__metadata("design:type", String)
|
|
14
|
+
], SaasAccountPatch.prototype, "id", void 0);
|
|
15
|
+
tslib_1.__decorate([
|
|
16
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }),
|
|
17
|
+
tslib_1.__metadata("design:type", String)
|
|
18
|
+
], SaasAccountPatch.prototype, "cuFlag", void 0);
|
|
19
|
+
tslib_1.__decorate([
|
|
20
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The service' }),
|
|
21
|
+
tslib_1.__metadata("design:type", String)
|
|
22
|
+
], SaasAccountPatch.prototype, "name", void 0);
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The vendor - a counterparty id' }),
|
|
25
|
+
tslib_1.__metadata("design:type", String)
|
|
26
|
+
], SaasAccountPatch.prototype, "counterpartyId", void 0);
|
|
27
|
+
tslib_1.__decorate([
|
|
28
|
+
(0, type_graphql_1.Field)({ nullable: true, description: "The vendor's name for the account" }),
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
30
|
+
], SaasAccountPatch.prototype, "identifier", void 0);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The account it is under - an account id' }),
|
|
33
|
+
tslib_1.__metadata("design:type", String)
|
|
34
|
+
], SaasAccountPatch.prototype, "parentId", void 0);
|
|
35
|
+
tslib_1.__decorate([
|
|
36
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'What it is used for' }),
|
|
37
|
+
tslib_1.__metadata("design:type", String)
|
|
38
|
+
], SaasAccountPatch.prototype, "purpose", void 0);
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'Who administers it - employee ids' }),
|
|
41
|
+
tslib_1.__metadata("design:type", Array)
|
|
42
|
+
], SaasAccountPatch.prototype, "adminIds", void 0);
|
|
43
|
+
tslib_1.__decorate([
|
|
44
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Where the vendor sends the bills' }),
|
|
45
|
+
tslib_1.__metadata("design:type", String)
|
|
46
|
+
], SaasAccountPatch.prototype, "billingEmail", void 0);
|
|
47
|
+
tslib_1.__decorate([
|
|
48
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'What it is paid from - a bank account or card id' }),
|
|
49
|
+
tslib_1.__metadata("design:type", String)
|
|
50
|
+
], SaasAccountPatch.prototype, "paymentAccountId", void 0);
|
|
51
|
+
tslib_1.__decorate([
|
|
52
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The currency its prices are in' }),
|
|
53
|
+
tslib_1.__metadata("design:type", String)
|
|
54
|
+
], SaasAccountPatch.prototype, "currency", void 0);
|
|
55
|
+
tslib_1.__decorate([
|
|
56
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Where its secrets are kept' }),
|
|
57
|
+
tslib_1.__metadata("design:type", String)
|
|
58
|
+
], SaasAccountPatch.prototype, "secretLocation", void 0);
|
|
59
|
+
tslib_1.__decorate([
|
|
60
|
+
(0, type_graphql_1.Field)(type => saas_rules_1.SaasAccountStatus, { nullable: true, description: 'In use or closed' }),
|
|
61
|
+
tslib_1.__metadata("design:type", String)
|
|
62
|
+
], SaasAccountPatch.prototype, "status", void 0);
|
|
63
|
+
tslib_1.__decorate([
|
|
64
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The day it was closed - YYYY-MM-DD' }),
|
|
65
|
+
tslib_1.__metadata("design:type", String)
|
|
66
|
+
], SaasAccountPatch.prototype, "closedOn", void 0);
|
|
67
|
+
tslib_1.__decorate([
|
|
68
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
|
|
69
|
+
tslib_1.__metadata("design:type", String)
|
|
70
|
+
], SaasAccountPatch.prototype, "description", void 0);
|
|
71
|
+
exports.SaasAccountPatch = SaasAccountPatch = tslib_1.__decorate([
|
|
72
|
+
(0, type_graphql_1.InputType)({ description: 'A row of the accounts grid (cuFlag + for new, M for changed, - for deleted)' })
|
|
73
|
+
], SaasAccountPatch);
|
|
74
|
+
let SaasSubscriptionPatch = class SaasSubscriptionPatch {
|
|
75
|
+
};
|
|
76
|
+
exports.SaasSubscriptionPatch = SaasSubscriptionPatch;
|
|
77
|
+
tslib_1.__decorate([
|
|
78
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The subscription; empty for a new one' }),
|
|
79
|
+
tslib_1.__metadata("design:type", String)
|
|
80
|
+
], SaasSubscriptionPatch.prototype, "id", void 0);
|
|
81
|
+
tslib_1.__decorate([
|
|
82
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }),
|
|
83
|
+
tslib_1.__metadata("design:type", String)
|
|
84
|
+
], SaasSubscriptionPatch.prototype, "cuFlag", void 0);
|
|
85
|
+
tslib_1.__decorate([
|
|
86
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The product and plan' }),
|
|
87
|
+
tslib_1.__metadata("design:type", String)
|
|
88
|
+
], SaasSubscriptionPatch.prototype, "name", void 0);
|
|
89
|
+
tslib_1.__decorate([
|
|
90
|
+
(0, type_graphql_1.Field)(type => saas_rules_1.SaasBilling, { nullable: true, description: 'How it is paid for' }),
|
|
91
|
+
tslib_1.__metadata("design:type", String)
|
|
92
|
+
], SaasSubscriptionPatch.prototype, "billing", void 0);
|
|
93
|
+
tslib_1.__decorate([
|
|
94
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'Seats or units' }),
|
|
95
|
+
tslib_1.__metadata("design:type", Number)
|
|
96
|
+
], SaasSubscriptionPatch.prototype, "quantity", void 0);
|
|
97
|
+
tslib_1.__decorate([
|
|
98
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { nullable: true, description: 'The price of one seat or unit, or the fee - for reference' }),
|
|
99
|
+
tslib_1.__metadata("design:type", Number)
|
|
100
|
+
], SaasSubscriptionPatch.prototype, "unitPrice", void 0);
|
|
101
|
+
tslib_1.__decorate([
|
|
102
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The day it started - YYYY-MM-DD' }),
|
|
103
|
+
tslib_1.__metadata("design:type", String)
|
|
104
|
+
], SaasSubscriptionPatch.prototype, "startOn", void 0);
|
|
105
|
+
tslib_1.__decorate([
|
|
106
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The day it renews - YYYY-MM-DD' }),
|
|
107
|
+
tslib_1.__metadata("design:type", String)
|
|
108
|
+
], SaasSubscriptionPatch.prototype, "renewalOn", void 0);
|
|
109
|
+
tslib_1.__decorate([
|
|
110
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Whether the vendor renews it unless cancelled' }),
|
|
111
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
112
|
+
], SaasSubscriptionPatch.prototype, "autoRenew", void 0);
|
|
113
|
+
tslib_1.__decorate([
|
|
114
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'Days before renewal it must be cancelled' }),
|
|
115
|
+
tslib_1.__metadata("design:type", Number)
|
|
116
|
+
], SaasSubscriptionPatch.prototype, "noticeDays", void 0);
|
|
117
|
+
tslib_1.__decorate([
|
|
118
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The department it is for - a department id' }),
|
|
119
|
+
tslib_1.__metadata("design:type", String)
|
|
120
|
+
], SaasSubscriptionPatch.prototype, "departmentId", void 0);
|
|
121
|
+
tslib_1.__decorate([
|
|
122
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'For a license owned: its asset - an asset id' }),
|
|
123
|
+
tslib_1.__metadata("design:type", String)
|
|
124
|
+
], SaasSubscriptionPatch.prototype, "assetId", void 0);
|
|
125
|
+
tslib_1.__decorate([
|
|
126
|
+
(0, type_graphql_1.Field)(type => saas_rules_1.SaasSubscriptionStatus, { nullable: true, description: 'In use, not to be renewed, or ended' }),
|
|
127
|
+
tslib_1.__metadata("design:type", String)
|
|
128
|
+
], SaasSubscriptionPatch.prototype, "status", void 0);
|
|
129
|
+
tslib_1.__decorate([
|
|
130
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The day it ended - YYYY-MM-DD' }),
|
|
131
|
+
tslib_1.__metadata("design:type", String)
|
|
132
|
+
], SaasSubscriptionPatch.prototype, "endedOn", void 0);
|
|
133
|
+
tslib_1.__decorate([
|
|
134
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
|
|
135
|
+
tslib_1.__metadata("design:type", String)
|
|
136
|
+
], SaasSubscriptionPatch.prototype, "description", void 0);
|
|
137
|
+
exports.SaasSubscriptionPatch = SaasSubscriptionPatch = tslib_1.__decorate([
|
|
138
|
+
(0, type_graphql_1.InputType)({ description: 'A row of the subscriptions grid of an account' })
|
|
139
|
+
], SaasSubscriptionPatch);
|
|
140
|
+
let SaasSeatPatch = class SaasSeatPatch {
|
|
141
|
+
};
|
|
142
|
+
exports.SaasSeatPatch = SaasSeatPatch;
|
|
143
|
+
tslib_1.__decorate([
|
|
144
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true, description: 'The seat; empty for a new one' }),
|
|
145
|
+
tslib_1.__metadata("design:type", String)
|
|
146
|
+
], SaasSeatPatch.prototype, "id", void 0);
|
|
147
|
+
tslib_1.__decorate([
|
|
148
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }),
|
|
149
|
+
tslib_1.__metadata("design:type", String)
|
|
150
|
+
], SaasSeatPatch.prototype, "cuFlag", void 0);
|
|
151
|
+
tslib_1.__decorate([
|
|
152
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The employee who holds it - an employee id' }),
|
|
153
|
+
tslib_1.__metadata("design:type", String)
|
|
154
|
+
], SaasSeatPatch.prototype, "employeeId", void 0);
|
|
155
|
+
tslib_1.__decorate([
|
|
156
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Who holds it when it is no employee' }),
|
|
157
|
+
tslib_1.__metadata("design:type", String)
|
|
158
|
+
], SaasSeatPatch.prototype, "holder", void 0);
|
|
159
|
+
tslib_1.__decorate([
|
|
160
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The day it was given - YYYY-MM-DD' }),
|
|
161
|
+
tslib_1.__metadata("design:type", String)
|
|
162
|
+
], SaasSeatPatch.prototype, "fromOn", void 0);
|
|
163
|
+
tslib_1.__decorate([
|
|
164
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The day it was taken back - YYYY-MM-DD' }),
|
|
165
|
+
tslib_1.__metadata("design:type", String)
|
|
166
|
+
], SaasSeatPatch.prototype, "untilOn", void 0);
|
|
167
|
+
tslib_1.__decorate([
|
|
168
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Notes' }),
|
|
169
|
+
tslib_1.__metadata("design:type", String)
|
|
170
|
+
], SaasSeatPatch.prototype, "description", void 0);
|
|
171
|
+
exports.SaasSeatPatch = SaasSeatPatch = tslib_1.__decorate([
|
|
172
|
+
(0, type_graphql_1.InputType)({ description: 'A row of the seats grid of a subscription' })
|
|
173
|
+
], SaasSeatPatch);
|
|
174
|
+
let SaasAccountList = class SaasAccountList {
|
|
175
|
+
};
|
|
176
|
+
exports.SaasAccountList = SaasAccountList;
|
|
177
|
+
tslib_1.__decorate([
|
|
178
|
+
(0, type_graphql_1.Field)(type => [saas_account_1.SaasAccount], { description: 'Accounts on the page' }),
|
|
179
|
+
tslib_1.__metadata("design:type", Array)
|
|
180
|
+
], SaasAccountList.prototype, "items", void 0);
|
|
181
|
+
tslib_1.__decorate([
|
|
182
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Number of accounts matching the list parameters' }),
|
|
183
|
+
tslib_1.__metadata("design:type", Number)
|
|
184
|
+
], SaasAccountList.prototype, "total", void 0);
|
|
185
|
+
exports.SaasAccountList = SaasAccountList = tslib_1.__decorate([
|
|
186
|
+
(0, type_graphql_1.ObjectType)({ description: 'A page of accounts' })
|
|
187
|
+
], SaasAccountList);
|
|
188
|
+
let SaasChange = class SaasChange {
|
|
189
|
+
};
|
|
190
|
+
exports.SaasChange = SaasChange;
|
|
191
|
+
tslib_1.__decorate([
|
|
192
|
+
(0, type_graphql_1.Field)({ description: 'What it moved on - the account or the subscription, by name' }),
|
|
193
|
+
tslib_1.__metadata("design:type", String)
|
|
194
|
+
], SaasChange.prototype, "subject", void 0);
|
|
195
|
+
tslib_1.__decorate([
|
|
196
|
+
(0, type_graphql_1.Field)({ description: 'saas-account or saas-subscription' }),
|
|
197
|
+
tslib_1.__metadata("design:type", String)
|
|
198
|
+
], SaasChange.prototype, "factKind", void 0);
|
|
199
|
+
tslib_1.__decorate([
|
|
200
|
+
(0, type_graphql_1.Field)({ description: 'Which field moved' }),
|
|
201
|
+
tslib_1.__metadata("design:type", String)
|
|
202
|
+
], SaasChange.prototype, "field", void 0);
|
|
203
|
+
tslib_1.__decorate([
|
|
204
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The value before, as text' }),
|
|
205
|
+
tslib_1.__metadata("design:type", String)
|
|
206
|
+
], SaasChange.prototype, "fromValue", void 0);
|
|
207
|
+
tslib_1.__decorate([
|
|
208
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The value after, as text' }),
|
|
209
|
+
tslib_1.__metadata("design:type", String)
|
|
210
|
+
], SaasChange.prototype, "toValue", void 0);
|
|
211
|
+
tslib_1.__decorate([
|
|
212
|
+
(0, type_graphql_1.Field)({ description: 'When it moved' }),
|
|
213
|
+
tslib_1.__metadata("design:type", Date)
|
|
214
|
+
], SaasChange.prototype, "at", void 0);
|
|
215
|
+
tslib_1.__decorate([
|
|
216
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Who moved it' }),
|
|
217
|
+
tslib_1.__metadata("design:type", String)
|
|
218
|
+
], SaasChange.prototype, "changedBy", void 0);
|
|
219
|
+
exports.SaasChange = SaasChange = tslib_1.__decorate([
|
|
220
|
+
(0, type_graphql_1.ObjectType)({ description: 'What moved on an account or one of its subscriptions' })
|
|
221
|
+
], SaasChange);
|
|
222
|
+
let SaasLicenseSkuInput = class SaasLicenseSkuInput {
|
|
223
|
+
};
|
|
224
|
+
exports.SaasLicenseSkuInput = SaasLicenseSkuInput;
|
|
225
|
+
tslib_1.__decorate([
|
|
226
|
+
(0, type_graphql_1.Field)({ description: "The vendor's id for the plan - a Microsoft 365 SKU id" }),
|
|
227
|
+
tslib_1.__metadata("design:type", String)
|
|
228
|
+
], SaasLicenseSkuInput.prototype, "skuId", void 0);
|
|
229
|
+
tslib_1.__decorate([
|
|
230
|
+
(0, type_graphql_1.Field)({ description: "The vendor's name for the plan" }),
|
|
231
|
+
tslib_1.__metadata("design:type", String)
|
|
232
|
+
], SaasLicenseSkuInput.prototype, "name", void 0);
|
|
233
|
+
tslib_1.__decorate([
|
|
234
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { description: 'How many were bought' }),
|
|
235
|
+
tslib_1.__metadata("design:type", Number)
|
|
236
|
+
], SaasLicenseSkuInput.prototype, "enabled", void 0);
|
|
237
|
+
tslib_1.__decorate([
|
|
238
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Float, { description: 'How many are assigned' }),
|
|
239
|
+
tslib_1.__metadata("design:type", Number)
|
|
240
|
+
], SaasLicenseSkuInput.prototype, "consumed", void 0);
|
|
241
|
+
tslib_1.__decorate([
|
|
242
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The day it renews, or a trial ends - YYYY-MM-DD' }),
|
|
243
|
+
tslib_1.__metadata("design:type", String)
|
|
244
|
+
], SaasLicenseSkuInput.prototype, "renewalOn", void 0);
|
|
245
|
+
tslib_1.__decorate([
|
|
246
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Whether it is a trial' }),
|
|
247
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
248
|
+
], SaasLicenseSkuInput.prototype, "trial", void 0);
|
|
249
|
+
exports.SaasLicenseSkuInput = SaasLicenseSkuInput = tslib_1.__decorate([
|
|
250
|
+
(0, type_graphql_1.InputType)({ description: 'A plan a vendor tenant bought (ADR-0177 amendment 2)' })
|
|
251
|
+
], SaasLicenseSkuInput);
|
|
252
|
+
let SaasLicenseUserInput = class SaasLicenseUserInput {
|
|
253
|
+
};
|
|
254
|
+
exports.SaasLicenseUserInput = SaasLicenseUserInput;
|
|
255
|
+
tslib_1.__decorate([
|
|
256
|
+
(0, type_graphql_1.Field)({ description: 'The login - a Microsoft 365 user name' }),
|
|
257
|
+
tslib_1.__metadata("design:type", String)
|
|
258
|
+
], SaasLicenseUserInput.prototype, "login", void 0);
|
|
259
|
+
tslib_1.__decorate([
|
|
260
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The mail' }),
|
|
261
|
+
tslib_1.__metadata("design:type", String)
|
|
262
|
+
], SaasLicenseUserInput.prototype, "mail", void 0);
|
|
263
|
+
tslib_1.__decorate([
|
|
264
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The name shown' }),
|
|
265
|
+
tslib_1.__metadata("design:type", String)
|
|
266
|
+
], SaasLicenseUserInput.prototype, "name", void 0);
|
|
267
|
+
tslib_1.__decorate([
|
|
268
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Whether the login can sign in' }),
|
|
269
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
270
|
+
], SaasLicenseUserInput.prototype, "enabled", void 0);
|
|
271
|
+
tslib_1.__decorate([
|
|
272
|
+
(0, type_graphql_1.Field)(type => [String], { description: 'The plans held - SKU ids' }),
|
|
273
|
+
tslib_1.__metadata("design:type", Array)
|
|
274
|
+
], SaasLicenseUserInput.prototype, "skuIds", void 0);
|
|
275
|
+
exports.SaasLicenseUserInput = SaasLicenseUserInput = tslib_1.__decorate([
|
|
276
|
+
(0, type_graphql_1.InputType)({ description: 'Who holds licenses at a vendor tenant' })
|
|
277
|
+
], SaasLicenseUserInput);
|
|
278
|
+
let SaasLicensesInput = class SaasLicensesInput {
|
|
279
|
+
};
|
|
280
|
+
exports.SaasLicensesInput = SaasLicensesInput;
|
|
281
|
+
tslib_1.__decorate([
|
|
282
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The tenant id' }),
|
|
283
|
+
tslib_1.__metadata("design:type", String)
|
|
284
|
+
], SaasLicensesInput.prototype, "tenantId", void 0);
|
|
285
|
+
tslib_1.__decorate([
|
|
286
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'The domains its users sign in with' }),
|
|
287
|
+
tslib_1.__metadata("design:type", Array)
|
|
288
|
+
], SaasLicensesInput.prototype, "domains", void 0);
|
|
289
|
+
tslib_1.__decorate([
|
|
290
|
+
(0, type_graphql_1.Field)(type => [SaasLicenseSkuInput], { description: 'The plans bought' }),
|
|
291
|
+
tslib_1.__metadata("design:type", Array)
|
|
292
|
+
], SaasLicensesInput.prototype, "skus", void 0);
|
|
293
|
+
tslib_1.__decorate([
|
|
294
|
+
(0, type_graphql_1.Field)(type => [SaasLicenseUserInput], { description: 'Who holds them' }),
|
|
295
|
+
tslib_1.__metadata("design:type", Array)
|
|
296
|
+
], SaasLicensesInput.prototype, "users", void 0);
|
|
297
|
+
exports.SaasLicensesInput = SaasLicensesInput = tslib_1.__decorate([
|
|
298
|
+
(0, type_graphql_1.InputType)({ description: 'What a vendor tenant bought and who holds each, as a scenario read it' })
|
|
299
|
+
], SaasLicensesInput);
|
|
300
|
+
let SaasLicenseSync = class SaasLicenseSync {
|
|
301
|
+
};
|
|
302
|
+
exports.SaasLicenseSync = SaasLicenseSync;
|
|
303
|
+
tslib_1.__decorate([
|
|
304
|
+
(0, type_graphql_1.Field)({ description: 'The account the tenant is' }),
|
|
305
|
+
tslib_1.__metadata("design:type", String)
|
|
306
|
+
], SaasLicenseSync.prototype, "accountId", void 0);
|
|
307
|
+
tslib_1.__decorate([
|
|
308
|
+
(0, type_graphql_1.Field)({ description: "The account's name" }),
|
|
309
|
+
tslib_1.__metadata("design:type", String)
|
|
310
|
+
], SaasLicenseSync.prototype, "accountName", void 0);
|
|
311
|
+
tslib_1.__decorate([
|
|
312
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Plans kept in step' }),
|
|
313
|
+
tslib_1.__metadata("design:type", Number)
|
|
314
|
+
], SaasLicenseSync.prototype, "subscriptions", void 0);
|
|
315
|
+
tslib_1.__decorate([
|
|
316
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Plans added as subscriptions' }),
|
|
317
|
+
tslib_1.__metadata("design:type", Number)
|
|
318
|
+
], SaasLicenseSync.prototype, "created", void 0);
|
|
319
|
+
tslib_1.__decorate([
|
|
320
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Seats opened' }),
|
|
321
|
+
tslib_1.__metadata("design:type", Number)
|
|
322
|
+
], SaasLicenseSync.prototype, "opened", void 0);
|
|
323
|
+
tslib_1.__decorate([
|
|
324
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Seats closed' }),
|
|
325
|
+
tslib_1.__metadata("design:type", Number)
|
|
326
|
+
], SaasLicenseSync.prototype, "closed", void 0);
|
|
327
|
+
tslib_1.__decorate([
|
|
328
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Open seats held as names that took their employee' }),
|
|
329
|
+
tslib_1.__metadata("design:type", Number)
|
|
330
|
+
], SaasLicenseSync.prototype, "linked", void 0);
|
|
331
|
+
tslib_1.__decorate([
|
|
332
|
+
(0, type_graphql_1.Field)(type => [String], { description: 'Logins no employee mail matched - held as names' }),
|
|
333
|
+
tslib_1.__metadata("design:type", Array)
|
|
334
|
+
], SaasLicenseSync.prototype, "unmatched", void 0);
|
|
335
|
+
exports.SaasLicenseSync = SaasLicenseSync = tslib_1.__decorate([
|
|
336
|
+
(0, type_graphql_1.ObjectType)({ description: 'What a sync of a vendor tenant changed' })
|
|
337
|
+
], SaasLicenseSync);
|
|
338
|
+
//# sourceMappingURL=saas-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saas-type.js","sourceRoot":"","sources":["../../server/service/saas-type.ts"],"names":[],"mappings":";;;;AAAA,+CAA2E;AAE3E,iDAA4C;AAC5C,6CAAqF;AAG9E,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAgB5B,CAAA;AAhBY,4CAAgB;AAC6D;IAAvF,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;;4CAAY;AACjB;IAAjF,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;;gDAAgB;AAC1C;IAAtD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;;8CAAc;AACM;IAAzE,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;;wDAAwB;AACpB;IAA5E,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;;oDAAoB;AACb;IAAlF,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;;kDAAkB;AACrC;IAA9D,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;;iDAAiB;AACgB;IAA9F,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,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B,EAAE,CAAC;;kDAAkB;AACxB;IAA7C,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;;oDAAoB;AACN;IAA1D,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;;sDAAsB;AACX;IAApE,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;;gDAAgB;AAC/B;IAApD,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;;+CAAe;AACd;IAApD,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;;+CAAe;AACuB;IAAzF,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,WAAW,EAAE,mDAAmD,EAAE,CAAC;;+CAAe;AACX;IAA5F,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;;kDAAoB;0BARrG,eAAe;IAD3B,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;GACzD,eAAe,CAS3B","sourcesContent":["import { Field, Float, ID, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { SaasAccount } from './saas-account'\nimport { SaasAccountStatus, SaasBilling, SaasSubscriptionStatus } from './saas-rules'\n\n@InputType({ description: 'A row of the accounts grid (cuFlag + for new, M for changed, - for deleted)' })\nexport class SaasAccountPatch {\n @Field(type => ID, { nullable: true, description: 'The account; empty for a new one' }) id?: string\n @Field({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }) cuFlag?: string\n @Field({ nullable: true, description: 'The service' }) name?: string\n @Field({ nullable: true, description: 'The vendor - a counterparty id' }) counterpartyId?: string\n @Field({ nullable: true, description: \"The vendor's name for the account\" }) identifier?: string\n @Field({ nullable: true, description: 'The account it is under - an account id' }) parentId?: string\n @Field({ nullable: true, description: 'What it is used for' }) purpose?: string\n @Field(type => [String], { nullable: true, description: 'Who administers it - employee ids' }) adminIds?: string[]\n @Field({ nullable: true, description: 'Where the vendor sends the bills' }) billingEmail?: string\n @Field({ nullable: true, description: 'What it is paid from - a bank account or card id' }) paymentAccountId?: string\n @Field({ nullable: true, description: 'The currency its prices are in' }) currency?: string\n @Field({ nullable: true, description: 'Where its secrets are kept' }) secretLocation?: string\n @Field(type => SaasAccountStatus, { nullable: true, description: 'In use or closed' }) status?: SaasAccountStatus\n @Field({ nullable: true, description: 'The day it was closed - YYYY-MM-DD' }) closedOn?: string\n @Field({ nullable: true, description: 'Notes' }) description?: string\n}\n\n@InputType({ description: 'A row of the subscriptions grid of an account' })\nexport class SaasSubscriptionPatch {\n @Field(type => ID, { nullable: true, description: 'The subscription; empty for a new one' }) id?: string\n @Field({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }) cuFlag?: string\n @Field({ nullable: true, description: 'The product and plan' }) name?: string\n @Field(type => SaasBilling, { nullable: true, description: 'How it is paid for' }) billing?: SaasBilling\n @Field(type => Float, { nullable: true, description: 'Seats or units' }) quantity?: number\n @Field(type => Float, { nullable: true, description: 'The price of one seat or unit, or the fee - for reference' }) unitPrice?: number\n @Field({ nullable: true, description: 'The day it started - YYYY-MM-DD' }) startOn?: string\n @Field({ nullable: true, description: 'The day it renews - YYYY-MM-DD' }) renewalOn?: string\n @Field({ nullable: true, description: 'Whether the vendor renews it unless cancelled' }) autoRenew?: boolean\n @Field(type => Int, { nullable: true, description: 'Days before renewal it must be cancelled' }) noticeDays?: number\n @Field({ nullable: true, description: 'The department it is for - a department id' }) departmentId?: string\n @Field({ nullable: true, description: 'For a license owned: its asset - an asset id' }) assetId?: string\n @Field(type => SaasSubscriptionStatus, { nullable: true, description: 'In use, not to be renewed, or ended' }) status?: SaasSubscriptionStatus\n @Field({ nullable: true, description: 'The day it ended - YYYY-MM-DD' }) endedOn?: string\n @Field({ nullable: true, description: 'Notes' }) description?: string\n}\n\n@InputType({ description: 'A row of the seats grid of a subscription' })\nexport class SaasSeatPatch {\n @Field(type => ID, { nullable: true, description: 'The seat; empty for a new one' }) id?: string\n @Field({ nullable: true, description: 'Grid flag: + new, M changed, - deleted' }) cuFlag?: string\n @Field({ nullable: true, description: 'The employee who holds it - an employee id' }) employeeId?: string\n @Field({ nullable: true, description: 'Who holds it when it is no employee' }) holder?: string\n @Field({ nullable: true, description: 'The day it was given - YYYY-MM-DD' }) fromOn?: string\n @Field({ nullable: true, description: 'The day it was taken back - YYYY-MM-DD' }) untilOn?: string\n @Field({ nullable: true, description: 'Notes' }) description?: string\n}\n\n@ObjectType({ description: 'A page of accounts' })\nexport class SaasAccountList {\n @Field(type => [SaasAccount], { description: 'Accounts on the page' }) items: SaasAccount[]\n @Field(type => Int, { description: 'Number of accounts matching the list parameters' }) total: number\n}\n\n@ObjectType({ description: 'What moved on an account or one of its subscriptions' })\nexport class SaasChange {\n @Field({ description: 'What it moved on - the account or the subscription, by name' }) subject: string\n @Field({ description: 'saas-account or saas-subscription' }) factKind: string\n @Field({ description: 'Which field moved' }) field: string\n @Field({ nullable: true, description: 'The value before, as text' }) fromValue?: string\n @Field({ nullable: true, description: 'The value after, as text' }) toValue?: string\n @Field({ description: 'When it moved' }) at: Date\n @Field({ nullable: true, description: 'Who moved it' }) changedBy?: string\n}\n\n@InputType({ description: 'A plan a vendor tenant bought (ADR-0177 amendment 2)' })\nexport class SaasLicenseSkuInput {\n @Field({ description: \"The vendor's id for the plan - a Microsoft 365 SKU id\" }) skuId: string\n @Field({ description: \"The vendor's name for the plan\" }) name: string\n @Field(type => Float, { description: 'How many were bought' }) enabled: number\n @Field(type => Float, { description: 'How many are assigned' }) consumed: number\n @Field({ nullable: true, description: 'The day it renews, or a trial ends - YYYY-MM-DD' }) renewalOn?: string\n @Field({ nullable: true, description: 'Whether it is a trial' }) trial?: boolean\n}\n\n@InputType({ description: 'Who holds licenses at a vendor tenant' })\nexport class SaasLicenseUserInput {\n @Field({ description: 'The login - a Microsoft 365 user name' }) login: string\n @Field({ nullable: true, description: 'The mail' }) mail?: string\n @Field({ nullable: true, description: 'The name shown' }) name?: string\n @Field({ nullable: true, description: 'Whether the login can sign in' }) enabled?: boolean\n @Field(type => [String], { description: 'The plans held - SKU ids' }) skuIds: string[]\n}\n\n@InputType({ description: 'What a vendor tenant bought and who holds each, as a scenario read it' })\nexport class SaasLicensesInput {\n @Field({ nullable: true, description: 'The tenant id' }) tenantId?: string\n @Field(type => [String], { nullable: true, description: 'The domains its users sign in with' }) domains?: string[]\n @Field(type => [SaasLicenseSkuInput], { description: 'The plans bought' }) skus: SaasLicenseSkuInput[]\n @Field(type => [SaasLicenseUserInput], { description: 'Who holds them' }) users: SaasLicenseUserInput[]\n}\n\n@ObjectType({ description: 'What a sync of a vendor tenant changed' })\nexport class SaasLicenseSync {\n @Field({ description: 'The account the tenant is' }) accountId: string\n @Field({ description: \"The account's name\" }) accountName: string\n @Field(type => Int, { description: 'Plans kept in step' }) subscriptions: number\n @Field(type => Int, { description: 'Plans added as subscriptions' }) created: number\n @Field(type => Int, { description: 'Seats opened' }) opened: number\n @Field(type => Int, { description: 'Seats closed' }) closed: number\n @Field(type => Int, { description: 'Open seats held as names that took their employee' }) linked: number\n @Field(type => [String], { description: 'Logins no employee mail matched - held as names' }) unmatched: string[]\n}\n"]}
|