@powerhousedao/contributor-billing 0.1.53 → 1.0.0-dev.10
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/document-models/account-transactions/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/account-transactions/gen/schema/zod.js +3 -3
- package/dist/document-models/account-transactions/module.d.ts +1 -1
- package/dist/document-models/account-transactions/module.d.ts.map +1 -1
- package/dist/document-models/account-transactions/module.js +1 -1
- package/dist/document-models/accounts/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/accounts/module.d.ts +1 -1
- package/dist/document-models/accounts/module.d.ts.map +1 -1
- package/dist/document-models/accounts/module.js +1 -1
- package/dist/document-models/billing-statement/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/billing-statement/gen/schema/zod.js +4 -4
- package/dist/document-models/billing-statement/module.d.ts +1 -1
- package/dist/document-models/billing-statement/module.d.ts.map +1 -1
- package/dist/document-models/billing-statement/module.js +1 -1
- package/dist/document-models/expense-report/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/expense-report/gen/schema/zod.js +38 -18
- package/dist/document-models/expense-report/module.d.ts +1 -1
- package/dist/document-models/expense-report/module.d.ts.map +1 -1
- package/dist/document-models/expense-report/module.js +1 -1
- package/dist/document-models/invoice/gen/document-model.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/document-model.js +150 -150
- package/dist/document-models/invoice/gen/schema/types.d.ts +3 -6
- package/dist/document-models/invoice/gen/schema/types.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.d.ts +2 -8
- package/dist/document-models/invoice/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/invoice/gen/schema/zod.js +14 -25
- package/dist/document-models/invoice/module.d.ts +1 -1
- package/dist/document-models/invoice/module.d.ts.map +1 -1
- package/dist/document-models/invoice/module.js +1 -1
- package/dist/document-models/invoice/src/reducers/general.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/general.js +8 -0
- package/dist/document-models/invoice/src/reducers/items.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/items.js +2 -1
- package/dist/document-models/invoice/src/reducers/parties.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/parties.js +6 -2
- package/dist/document-models/invoice/src/reducers/transitions.d.ts +0 -5
- package/dist/document-models/invoice/src/reducers/transitions.d.ts.map +1 -1
- package/dist/document-models/invoice/src/reducers/transitions.js +19 -6
- package/dist/document-models/invoice/tests/general.test.js +11 -2
- package/dist/document-models/invoice/tests/items.test.js +1 -1
- package/dist/document-models/invoice/tests/parties.test.js +1 -1
- package/dist/document-models/invoice/tests/transitions.test.js +7 -2
- package/dist/document-models/operational-hub-profile/module.d.ts +1 -1
- package/dist/document-models/operational-hub-profile/module.d.ts.map +1 -1
- package/dist/document-models/operational-hub-profile/module.js +1 -1
- package/dist/document-models/snapshot-report/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/snapshot-report/gen/schema/zod.js +12 -12
- package/dist/document-models/snapshot-report/module.d.ts +1 -1
- package/dist/document-models/snapshot-report/module.d.ts.map +1 -1
- package/dist/document-models/snapshot-report/module.js +1 -1
- package/dist/editors/accounts-editor/editor.d.ts.map +1 -1
- package/dist/editors/accounts-editor/editor.js +2 -2
- package/dist/editors/builder-team-admin/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/builder-team-admin/components/DriveExplorer.js +64 -4
- package/dist/editors/builder-team-admin/module.js +1 -1
- package/dist/editors/contributor-billing/components/DashboardHome.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DashboardHome.js +2 -8
- package/dist/editors/contributor-billing/components/DocumentDropZone.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DocumentDropZone.js +37 -8
- package/dist/editors/contributor-billing/components/DriveContents.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveContents.js +4 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/DriveExplorer.js +54 -3
- package/dist/editors/contributor-billing/components/FolderTree.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/FolderTree.js +6 -15
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts +2 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/HeaderControls.js +41 -6
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTable.js +16 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableContainer.d.ts +3 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableContainer.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/InvoiceTable/InvoiceTableContainer.js +13 -11
- package/dist/editors/contributor-billing/components/MonthReportCard.d.ts +11 -4
- package/dist/editors/contributor-billing/components/MonthReportCard.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/MonthReportCard.js +55 -6
- package/dist/editors/contributor-billing/components/MonthlyReportsOverview.d.ts +1 -1
- package/dist/editors/contributor-billing/components/MonthlyReportsOverview.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/MonthlyReportsOverview.js +104 -7
- package/dist/editors/contributor-billing/components/ReportingView.d.ts +0 -3
- package/dist/editors/contributor-billing/components/ReportingView.d.ts.map +1 -1
- package/dist/editors/contributor-billing/components/ReportingView.js +65 -8
- package/dist/editors/contributor-billing/components/ToastRenderer.d.ts +2 -0
- package/dist/editors/contributor-billing/components/ToastRenderer.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/ToastRenderer.js +14 -0
- package/dist/editors/contributor-billing/components/cbToast.d.ts +16 -0
- package/dist/editors/contributor-billing/components/cbToast.d.ts.map +1 -0
- package/dist/editors/contributor-billing/components/cbToast.js +29 -0
- package/dist/editors/contributor-billing/hooks/useDocumentAutoPlacement.d.ts.map +1 -1
- package/dist/editors/contributor-billing/hooks/useDocumentAutoPlacement.js +42 -2
- package/dist/editors/contributor-billing/hooks/useMonthlyReports.d.ts +4 -0
- package/dist/editors/contributor-billing/hooks/useMonthlyReports.d.ts.map +1 -1
- package/dist/editors/contributor-billing/hooks/useMonthlyReports.js +4 -0
- package/dist/editors/contributor-billing/module.js +1 -1
- package/dist/editors/invoice/InvoicePDF.d.ts.map +1 -1
- package/dist/editors/invoice/InvoicePDF.js +12 -9
- package/dist/editors/invoice/editor.d.ts.map +1 -1
- package/dist/editors/invoice/editor.js +6 -10
- package/dist/editors/invoice/exportUBL.d.ts.map +1 -1
- package/dist/editors/invoice/exportUBL.js +1 -2
- package/dist/editors/invoice/ingestPDF.js +1 -1
- package/dist/editors/invoice/invoiceToGnosis.d.ts.map +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +25 -22
- package/dist/editors/invoice/invoiceToast.d.ts +4 -0
- package/dist/editors/invoice/invoiceToast.d.ts.map +1 -0
- package/dist/editors/invoice/invoiceToast.js +6 -0
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts +2 -1
- package/dist/editors/invoice/legalEntity/legalEntity.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/legalEntity.js +3 -14
- package/dist/editors/invoice/legalEntity/walletSection.d.ts +1 -0
- package/dist/editors/invoice/legalEntity/walletSection.d.ts.map +1 -1
- package/dist/editors/invoice/legalEntity/walletSection.js +2 -2
- package/dist/editors/invoice/lineItems.js +1 -1
- package/dist/editors/invoice/requestFinance.d.ts +3 -2
- package/dist/editors/invoice/requestFinance.d.ts.map +1 -1
- package/dist/editors/invoice/requestFinance.js +38 -42
- package/dist/editors/invoice/validation/validationHandler.d.ts +1 -1
- package/dist/editors/invoice/validation/validationHandler.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationHandler.js +15 -2
- package/dist/editors/invoice/validation/validationManager.d.ts +1 -1
- package/dist/editors/invoice/validation/validationManager.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationManager.js +2 -1
- package/dist/editors/invoice/validation/validationRules.d.ts +1 -0
- package/dist/editors/invoice/validation/validationRules.d.ts.map +1 -1
- package/dist/editors/invoice/validation/validationRules.js +26 -1
- package/dist/editors/snapshot-report-editor/components/DateRangePicker.d.ts +19 -0
- package/dist/editors/snapshot-report-editor/components/DateRangePicker.d.ts.map +1 -0
- package/dist/editors/snapshot-report-editor/components/DateRangePicker.js +66 -0
- package/dist/editors/snapshot-report-editor/editor.d.ts.map +1 -1
- package/dist/editors/snapshot-report-editor/editor.js +72 -48
- package/dist/scripts/download-all-drive-documents/download-drive-documents.d.ts +33 -0
- package/dist/scripts/download-all-drive-documents/download-drive-documents.d.ts.map +1 -0
- package/dist/scripts/download-all-drive-documents/download-drive-documents.js +583 -0
- package/dist/scripts/invoice/requestFinance.d.ts +18 -1
- package/dist/scripts/invoice/requestFinance.d.ts.map +1 -1
- package/dist/scripts/invoice/requestFinance.js +17 -5
- package/dist/scripts/upload-phd-documents/upload-phd-documents.d.ts +20 -0
- package/dist/scripts/upload-phd-documents/upload-phd-documents.d.ts.map +1 -0
- package/dist/scripts/upload-phd-documents/upload-phd-documents.js +313 -0
- package/dist/style.css +201 -106
- package/dist/subgraphs/budget-statements/resolvers.d.ts +38 -0
- package/dist/subgraphs/budget-statements/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/budget-statements/resolvers.js +192 -62
- package/dist/subgraphs/budget-statements/resolvers.test.d.ts +2 -0
- package/dist/subgraphs/budget-statements/resolvers.test.d.ts.map +1 -0
- package/dist/subgraphs/budget-statements/resolvers.test.js +339 -0
- package/dist/subgraphs/budget-statements/schema.d.ts.map +1 -1
- package/dist/subgraphs/budget-statements/schema.js +8 -0
- package/dist/subgraphs/index.d.ts +0 -1
- package/dist/subgraphs/index.d.ts.map +1 -1
- package/dist/subgraphs/index.js +0 -1
- package/dist/subgraphs/invoice-addon/customResolvers.d.ts +70 -11
- package/dist/subgraphs/invoice-addon/customResolvers.d.ts.map +1 -1
- package/dist/subgraphs/invoice-addon/customResolvers.js +12 -27
- package/package.json +35 -28
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts +0 -10
- package/dist/document-models/invoice/src/tests/document-model.test.d.ts.map +0 -1
- package/dist/document-models/invoice/src/tests/document-model.test.js +0 -104
- package/dist/document-models/invoice/src/tests/general.test.d.ts +0 -6
- package/dist/document-models/invoice/src/tests/general.test.d.ts.map +0 -1
- package/dist/document-models/invoice/src/tests/general.test.js +0 -49
- package/dist/document-models/invoice/src/tests/items.test.d.ts +0 -6
- package/dist/document-models/invoice/src/tests/items.test.d.ts.map +0 -1
- package/dist/document-models/invoice/src/tests/items.test.js +0 -59
- package/dist/document-models/invoice/src/tests/parties.test.d.ts +0 -6
- package/dist/document-models/invoice/src/tests/parties.test.d.ts.map +0 -1
- package/dist/document-models/invoice/src/tests/parties.test.js +0 -69
- package/dist/document-models/invoice/src/tests/transitions.test.d.ts +0 -6
- package/dist/document-models/invoice/src/tests/transitions.test.d.ts.map +0 -1
- package/dist/document-models/invoice/src/tests/transitions.test.js +0 -59
- package/dist/document-models/invoice/utils/statusTransitions.d.ts +0 -13
- package/dist/document-models/invoice/utils/statusTransitions.d.ts.map +0 -1
- package/dist/document-models/invoice/utils/statusTransitions.js +0 -13
- package/dist/editors/builder-team-admin/components/overview/SubscriptionsStats.d.ts +0 -15
- package/dist/editors/builder-team-admin/components/overview/SubscriptionsStats.d.ts.map +0 -1
- package/dist/editors/builder-team-admin/components/overview/SubscriptionsStats.js +0 -61
- package/dist/editors/contributor-billing/components/CreateHubProfileModal.d.ts +0 -12
- package/dist/editors/contributor-billing/components/CreateHubProfileModal.d.ts.map +0 -1
- package/dist/editors/contributor-billing/components/CreateHubProfileModal.js +0 -74
- package/dist/subgraphs/resources-services/index.d.ts +0 -11
- package/dist/subgraphs/resources-services/index.d.ts.map +0 -1
- package/dist/subgraphs/resources-services/index.js +0 -11
- package/dist/subgraphs/resources-services/resolvers.d.ts +0 -3
- package/dist/subgraphs/resources-services/resolvers.d.ts.map +0 -1
- package/dist/subgraphs/resources-services/resolvers.js +0 -462
- package/dist/subgraphs/resources-services/schema.d.ts +0 -3
- package/dist/subgraphs/resources-services/schema.d.ts.map +0 -1
- package/dist/subgraphs/resources-services/schema.js +0 -284
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
interface CreateHubProfileModalProps {
|
|
2
|
-
isOpen: boolean;
|
|
3
|
-
onClose: () => void;
|
|
4
|
-
onCreated?: (documentId: string) => void;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Custom modal for creating an Operational Hub Profile
|
|
8
|
-
* Uses the same design as the classic Connect CreateDocumentModal
|
|
9
|
-
*/
|
|
10
|
-
export declare function CreateHubProfileModal({ isOpen, onClose, onCreated, }: CreateHubProfileModalProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=CreateHubProfileModal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHubProfileModal.d.ts","sourceRoot":"","sources":["../../../../editors/contributor-billing/components/CreateHubProfileModal.tsx"],"names":[],"mappings":"AAkBA,UAAU,0BAA0B;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,OAAO,EACP,SAAS,GACV,EAAE,0BAA0B,2CAiI5B"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useCallback, useEffect } from "react";
|
|
3
|
-
import { Icon, Modal, PowerhouseButton } from "@powerhousedao/design-system";
|
|
4
|
-
import { FormInput } from "@powerhousedao/design-system/connect";
|
|
5
|
-
import { addDocument, dispatchActions, useSelectedDrive, setSelectedNode, } from "@powerhousedao/reactor-browser";
|
|
6
|
-
import { setName } from "document-model";
|
|
7
|
-
import { twMerge } from "tailwind-merge";
|
|
8
|
-
import { setOperationalHubName } from "../../../document-models/operational-hub-profile/gen/configuration/creators.js";
|
|
9
|
-
const buttonStyles = "min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all";
|
|
10
|
-
const CLOSE_ANIMATION_DURATION = 300;
|
|
11
|
-
/**
|
|
12
|
-
* Custom modal for creating an Operational Hub Profile
|
|
13
|
-
* Uses the same design as the classic Connect CreateDocumentModal
|
|
14
|
-
*/
|
|
15
|
-
export function CreateHubProfileModal({ isOpen, onClose, onCreated, }) {
|
|
16
|
-
const [hubName, setHubName] = useState("");
|
|
17
|
-
const [isCreating, setIsCreating] = useState(false);
|
|
18
|
-
const [selectedDrive] = useSelectedDrive();
|
|
19
|
-
// Reset state when modal closes
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (!isOpen) {
|
|
22
|
-
setTimeout(() => setHubName(""), CLOSE_ANIMATION_DURATION);
|
|
23
|
-
setIsCreating(false);
|
|
24
|
-
}
|
|
25
|
-
}, [isOpen]);
|
|
26
|
-
const handleCancel = useCallback(() => {
|
|
27
|
-
onClose();
|
|
28
|
-
setTimeout(() => setHubName(""), CLOSE_ANIMATION_DURATION);
|
|
29
|
-
}, [onClose]);
|
|
30
|
-
const handleCreate = useCallback(async () => {
|
|
31
|
-
const trimmedName = hubName.trim();
|
|
32
|
-
const driveId = selectedDrive?.header.id;
|
|
33
|
-
if (!trimmedName || !driveId || isCreating)
|
|
34
|
-
return;
|
|
35
|
-
setIsCreating(true);
|
|
36
|
-
try {
|
|
37
|
-
// Create the document with the entered name
|
|
38
|
-
const createdNode = await addDocument(driveId, trimmedName, "powerhouse/operational-hub-profile", undefined, undefined, undefined, "operational-hub-profile-editor");
|
|
39
|
-
if (!createdNode?.id) {
|
|
40
|
-
console.error("Failed to create operational hub profile document");
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
// Set the hub name field in the document state
|
|
44
|
-
await dispatchActions(setOperationalHubName({ name: trimmedName }), createdNode.id);
|
|
45
|
-
// Set the document name to match
|
|
46
|
-
await dispatchActions(setName(trimmedName), createdNode.id);
|
|
47
|
-
// Select the newly created document
|
|
48
|
-
setSelectedNode(createdNode.id);
|
|
49
|
-
// Notify parent and close
|
|
50
|
-
onCreated?.(createdNode.id);
|
|
51
|
-
onClose();
|
|
52
|
-
setTimeout(() => setHubName(""), CLOSE_ANIMATION_DURATION);
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
console.error("Error creating operational hub profile:", error);
|
|
56
|
-
}
|
|
57
|
-
finally {
|
|
58
|
-
setIsCreating(false);
|
|
59
|
-
}
|
|
60
|
-
}, [hubName, selectedDrive?.header.id, isCreating, onCreated, onClose]);
|
|
61
|
-
const handleSubmit = useCallback((e) => {
|
|
62
|
-
e.preventDefault();
|
|
63
|
-
if (hubName.trim() && !isCreating) {
|
|
64
|
-
void handleCreate();
|
|
65
|
-
}
|
|
66
|
-
}, [hubName, isCreating, handleCreate]);
|
|
67
|
-
const isValid = hubName.trim().length > 0;
|
|
68
|
-
return (_jsx(Modal, { open: isOpen, onOpenChange: (open) => {
|
|
69
|
-
if (!open)
|
|
70
|
-
handleCancel();
|
|
71
|
-
}, contentProps: {
|
|
72
|
-
className: "rounded-3xl",
|
|
73
|
-
}, children: _jsxs("form", { name: "create-hub-profile", className: "w-[400px] p-6 text-slate-300", onSubmit: handleSubmit, children: [_jsx("div", { className: "border-b border-slate-50 pb-2 text-2xl font-bold text-gray-800", children: "Create your Operational Hub profile" }), _jsx("div", { className: "my-6", children: _jsx(FormInput, { icon: _jsx(Icon, { name: "BrickGlobe" }), onChange: (e) => setHubName(e.target.value), placeholder: "Operational Hub name", required: true, value: hubName, disabled: isCreating }) }), _jsxs("div", { className: "mt-8 flex justify-between gap-3", children: [_jsx("button", { type: "button", className: twMerge(buttonStyles, "flex-1 bg-slate-50 text-slate-800"), onClick: handleCancel, disabled: isCreating, children: "Cancel" }), _jsx(PowerhouseButton, { type: "submit", className: twMerge(buttonStyles, "flex-1 bg-gray-800 text-gray-50"), disabled: !isValid || isCreating, children: isCreating ? "Creating..." : "Create" })] })] }) }));
|
|
74
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BaseSubgraph } from "@powerhousedao/reactor-api";
|
|
2
|
-
import type { DocumentNode } from "graphql";
|
|
3
|
-
export declare class ResourcesServicesSubgraph extends BaseSubgraph {
|
|
4
|
-
name: string;
|
|
5
|
-
typeDefs: DocumentNode;
|
|
6
|
-
resolvers: Record<string, unknown>;
|
|
7
|
-
additionalContextFields: {};
|
|
8
|
-
onSetup(): Promise<void>;
|
|
9
|
-
onDisconnect(): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../subgraphs/resources-services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,qBAAa,yBAA0B,SAAQ,YAAY;IACzD,IAAI,SAAwB;IAC5B,QAAQ,EAAE,YAAY,CAAU;IAChC,SAAS,0BAAsB;IAC/B,uBAAuB,KAAM;IACvB,OAAO;IACP,YAAY;CACnB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BaseSubgraph } from "@powerhousedao/reactor-api";
|
|
2
|
-
import { schema } from "./schema.js";
|
|
3
|
-
import { getResolvers } from "./resolvers.js";
|
|
4
|
-
export class ResourcesServicesSubgraph extends BaseSubgraph {
|
|
5
|
-
name = "resources-services";
|
|
6
|
-
typeDefs = schema;
|
|
7
|
-
resolvers = getResolvers(this);
|
|
8
|
-
additionalContextFields = {};
|
|
9
|
-
async onSetup() { }
|
|
10
|
-
async onDisconnect() { }
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/resources-services/resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAkC5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAyUxE,CAAC"}
|
|
@@ -1,462 +0,0 @@
|
|
|
1
|
-
import {} from "@powerhousedao/reactor-api";
|
|
2
|
-
import { addFile } from "document-drive";
|
|
3
|
-
import { BuilderProfile } from "@powerhousedao/builder-profile/document-models";
|
|
4
|
-
import { ResourceInstance } from "@powerhousedao/service-offering/document-models";
|
|
5
|
-
export const getResolvers = (subgraph) => {
|
|
6
|
-
const reactor = subgraph.reactor;
|
|
7
|
-
return {
|
|
8
|
-
Query: {
|
|
9
|
-
resourceTemplates: async (_, args) => {
|
|
10
|
-
const { id, status, operatorId } = args.filter || {};
|
|
11
|
-
// If filtering by specific id, try to fetch directly
|
|
12
|
-
if (id) {
|
|
13
|
-
try {
|
|
14
|
-
const doc = await reactor.getDocument(id);
|
|
15
|
-
if (doc &&
|
|
16
|
-
doc.header.documentType === "powerhouse/resource-template") {
|
|
17
|
-
const state = doc.state.global;
|
|
18
|
-
// Check status filter if provided
|
|
19
|
-
if (status &&
|
|
20
|
-
status.length > 0 &&
|
|
21
|
-
!status.includes(state.status)) {
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
// Check operatorId filter if provided
|
|
25
|
-
if (operatorId && state.operatorId !== operatorId) {
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
|
-
return [mapResourceTemplateState(state, doc)];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
// Document not found
|
|
33
|
-
}
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
// Scan all drives for resource template documents
|
|
37
|
-
const drives = await reactor.getDrives();
|
|
38
|
-
const resourceTemplates = [];
|
|
39
|
-
for (const driveId of drives) {
|
|
40
|
-
try {
|
|
41
|
-
const docIds = await reactor.getDocuments(driveId);
|
|
42
|
-
const docs = await Promise.all(docIds.map(async (docId) => {
|
|
43
|
-
try {
|
|
44
|
-
return await reactor.getDocument(docId);
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
}));
|
|
50
|
-
for (const doc of docs) {
|
|
51
|
-
if (doc &&
|
|
52
|
-
doc.header.documentType === "powerhouse/resource-template") {
|
|
53
|
-
const resourceDoc = doc;
|
|
54
|
-
const state = resourceDoc.state.global;
|
|
55
|
-
// Apply status filter if provided
|
|
56
|
-
if (status &&
|
|
57
|
-
status.length > 0 &&
|
|
58
|
-
!status.includes(state.status)) {
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
// Apply operatorId filter if provided
|
|
62
|
-
if (operatorId && state.operatorId !== operatorId) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
resourceTemplates.push(mapResourceTemplateState(state, doc));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
console.warn(`Failed to inspect drive ${driveId}:`, error);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return resourceTemplates;
|
|
74
|
-
},
|
|
75
|
-
serviceOfferings: async (_, args) => {
|
|
76
|
-
const { id, status, operatorId, resourceTemplateId } = args.filter || {};
|
|
77
|
-
// If filtering by specific id, try to fetch directly
|
|
78
|
-
if (id) {
|
|
79
|
-
try {
|
|
80
|
-
const doc = await reactor.getDocument(id);
|
|
81
|
-
if (doc &&
|
|
82
|
-
doc.header.documentType === "powerhouse/service-offering") {
|
|
83
|
-
const state = doc.state.global;
|
|
84
|
-
// Check status filter if provided
|
|
85
|
-
if (status &&
|
|
86
|
-
status.length > 0 &&
|
|
87
|
-
!status.includes(state.status)) {
|
|
88
|
-
return [];
|
|
89
|
-
}
|
|
90
|
-
// Check operatorId filter if provided
|
|
91
|
-
if (operatorId && state.operatorId !== operatorId) {
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
// Check resourceTemplateId filter if provided
|
|
95
|
-
if (resourceTemplateId &&
|
|
96
|
-
state.resourceTemplateId !== resourceTemplateId) {
|
|
97
|
-
return [];
|
|
98
|
-
}
|
|
99
|
-
return [mapServiceOfferingState(state, doc)];
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
// Document not found
|
|
104
|
-
}
|
|
105
|
-
return [];
|
|
106
|
-
}
|
|
107
|
-
// Scan all drives for service offering documents
|
|
108
|
-
const drives = await reactor.getDrives();
|
|
109
|
-
const serviceOfferings = [];
|
|
110
|
-
for (const driveId of drives) {
|
|
111
|
-
try {
|
|
112
|
-
const docIds = await reactor.getDocuments(driveId);
|
|
113
|
-
const docs = await Promise.all(docIds.map(async (docId) => {
|
|
114
|
-
try {
|
|
115
|
-
return await reactor.getDocument(docId);
|
|
116
|
-
}
|
|
117
|
-
catch {
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
}));
|
|
121
|
-
for (const doc of docs) {
|
|
122
|
-
if (doc &&
|
|
123
|
-
doc.header.documentType === "powerhouse/service-offering") {
|
|
124
|
-
const offeringDoc = doc;
|
|
125
|
-
const state = offeringDoc.state.global;
|
|
126
|
-
// Apply status filter if provided
|
|
127
|
-
if (status &&
|
|
128
|
-
status.length > 0 &&
|
|
129
|
-
!status.includes(state.status)) {
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
// Apply operatorId filter if provided
|
|
133
|
-
if (operatorId && state.operatorId !== operatorId) {
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
// Apply resourceTemplateId filter if provided
|
|
137
|
-
if (resourceTemplateId &&
|
|
138
|
-
state.resourceTemplateId !== resourceTemplateId) {
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
serviceOfferings.push(mapServiceOfferingState(state, doc));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
console.warn(`Failed to inspect drive ${driveId}:`, error);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return serviceOfferings;
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
Mutation: {
|
|
153
|
-
createResourceInstances: async (_, args) => {
|
|
154
|
-
const { input } = args;
|
|
155
|
-
const { resourceTemplateId, name, teamName } = input;
|
|
156
|
-
// Validate input
|
|
157
|
-
if (!resourceTemplateId) {
|
|
158
|
-
return {
|
|
159
|
-
success: false,
|
|
160
|
-
data: null,
|
|
161
|
-
errors: ["Resource template ID is required"],
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
if (!name) {
|
|
165
|
-
return { success: false, data: null, errors: ["Name is required"] };
|
|
166
|
-
}
|
|
167
|
-
if (!teamName) {
|
|
168
|
-
return {
|
|
169
|
-
success: false,
|
|
170
|
-
data: null,
|
|
171
|
-
errors: ["Team name is required"],
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
const parsedTeamName = teamName.toLowerCase().replace(/ /g, "-");
|
|
175
|
-
const parsedName = name.toLowerCase().replace(/ /g, "-");
|
|
176
|
-
try {
|
|
177
|
-
// create team-builder-admin drive
|
|
178
|
-
const teamBuilderAdminDrive = await reactor.addDrive({
|
|
179
|
-
global: {
|
|
180
|
-
name: teamName,
|
|
181
|
-
icon: "https://cdn-icons-png.flaticon.com/512/6020/6020347.png",
|
|
182
|
-
},
|
|
183
|
-
id: parsedTeamName,
|
|
184
|
-
slug: parsedTeamName,
|
|
185
|
-
preferredEditor: "builder-team-admin",
|
|
186
|
-
});
|
|
187
|
-
teamBuilderAdminDrive.header.id;
|
|
188
|
-
// create builder-profile doc inside the team-builder-admin drive
|
|
189
|
-
const builderProfileDoc = await reactor.addDocument("powerhouse/builder-profile");
|
|
190
|
-
await reactor.addAction(teamBuilderAdminDrive.header.id, addFile({
|
|
191
|
-
documentType: "powerhouse/builder-profile",
|
|
192
|
-
id: builderProfileDoc.header.id,
|
|
193
|
-
name: `${parsedName} Builder Profile`,
|
|
194
|
-
parentFolder: teamBuilderAdminDrive.state.global.nodes?.find((node) => node.kind === "folder")?.parentFolder,
|
|
195
|
-
}));
|
|
196
|
-
await reactor.addAction(builderProfileDoc.header.id, BuilderProfile.actions.updateProfile({
|
|
197
|
-
name: name,
|
|
198
|
-
}));
|
|
199
|
-
// create resource-instance doc inside the team-builder-admin drive
|
|
200
|
-
const resourceInstanceDoc = await reactor.addDocument("powerhouse/resource-instance");
|
|
201
|
-
await reactor.addAction(teamBuilderAdminDrive.header.id, addFile({
|
|
202
|
-
documentType: "powerhouse/resource-instance",
|
|
203
|
-
id: resourceInstanceDoc.header.id,
|
|
204
|
-
name: `${parsedName} Resource Instance`,
|
|
205
|
-
parentFolder: teamBuilderAdminDrive.state.global.nodes?.find((node) => node.kind === "folder")?.parentFolder,
|
|
206
|
-
}));
|
|
207
|
-
await populateResourceInstance(reactor, resourceInstanceDoc.header.id, resourceTemplateId, builderProfileDoc.header.id, name);
|
|
208
|
-
// create copy of resource-instance doc inside the operator's drive
|
|
209
|
-
const operatorDrive = await getOperatorDrive(reactor, resourceTemplateId);
|
|
210
|
-
if (!operatorDrive) {
|
|
211
|
-
throw new Error(`Operator drive not found for resource template ${resourceTemplateId}`);
|
|
212
|
-
}
|
|
213
|
-
await reactor.addAction(operatorDrive.header.id, addFile({
|
|
214
|
-
documentType: "powerhouse/resource-instance",
|
|
215
|
-
id: resourceInstanceDoc.header.id,
|
|
216
|
-
name: `${parsedName} Resource Instance`,
|
|
217
|
-
parentFolder: operatorDrive.state.global.nodes?.find((node) => node.kind === "folder")?.parentFolder,
|
|
218
|
-
}));
|
|
219
|
-
return {
|
|
220
|
-
success: true,
|
|
221
|
-
data: {
|
|
222
|
-
linkToDrive: getDriveLink(teamBuilderAdminDrive.header.id),
|
|
223
|
-
},
|
|
224
|
-
errors: [],
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
catch (error) {
|
|
228
|
-
console.error("Failed to create resource instance:", error);
|
|
229
|
-
return {
|
|
230
|
-
success: false,
|
|
231
|
-
data: null,
|
|
232
|
-
errors: [
|
|
233
|
-
error instanceof Error
|
|
234
|
-
? error.message
|
|
235
|
-
: "An unexpected error occurred",
|
|
236
|
-
],
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
},
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
/**
|
|
244
|
-
* Build a link to a drive based on the current environment.
|
|
245
|
-
* Mirrors the logic from editors/shared/graphql.ts for server-side use.
|
|
246
|
-
*/
|
|
247
|
-
function getDriveLink(driveId) {
|
|
248
|
-
const baseUri = process.env.BASE_URI || "";
|
|
249
|
-
if (baseUri.includes("-dev.")) {
|
|
250
|
-
return `https://connect-dev.powerhouse.xyz/?driveUrl=https://switchboard-dev.powerhouse.xyz/d/${driveId}`;
|
|
251
|
-
}
|
|
252
|
-
if (baseUri.includes("-staging.")) {
|
|
253
|
-
return `https://connect-staging.powerhouse.xyz/?driveUrl=https://switchboard-staging.powerhouse.xyz/d/${driveId}`;
|
|
254
|
-
}
|
|
255
|
-
if (baseUri && !baseUri.includes("localhost")) {
|
|
256
|
-
return `https://connect.powerhouse.xyz/?driveUrl=https://switchboard.powerhouse.xyz/d/${driveId}`;
|
|
257
|
-
}
|
|
258
|
-
return `http://localhost:3000/?driveUrl=http://localhost:4001/d/${driveId}`;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Map ResourceTemplateState from document model to GraphQL response
|
|
262
|
-
*/
|
|
263
|
-
function mapResourceTemplateState(state, doc) {
|
|
264
|
-
return {
|
|
265
|
-
id: doc.header.id,
|
|
266
|
-
operatorId: state.operatorId,
|
|
267
|
-
title: state.title,
|
|
268
|
-
summary: state.summary,
|
|
269
|
-
description: state.description || null,
|
|
270
|
-
thumbnailUrl: state.thumbnailUrl || null,
|
|
271
|
-
infoLink: state.infoLink || null,
|
|
272
|
-
status: state.status,
|
|
273
|
-
lastModified: state.lastModified,
|
|
274
|
-
targetAudiences: state.targetAudiences.map((audience) => ({
|
|
275
|
-
id: audience.id,
|
|
276
|
-
label: audience.label,
|
|
277
|
-
color: audience.color || null,
|
|
278
|
-
})),
|
|
279
|
-
setupServices: state.setupServices,
|
|
280
|
-
recurringServices: state.recurringServices,
|
|
281
|
-
facetTargets: state.facetTargets.map((facet) => ({
|
|
282
|
-
id: facet.id,
|
|
283
|
-
categoryKey: facet.categoryKey,
|
|
284
|
-
categoryLabel: facet.categoryLabel,
|
|
285
|
-
selectedOptions: facet.selectedOptions,
|
|
286
|
-
})),
|
|
287
|
-
services: (state.services || []).map((service) => ({
|
|
288
|
-
id: service.id,
|
|
289
|
-
title: service.title,
|
|
290
|
-
description: service.description || null,
|
|
291
|
-
displayOrder: service.displayOrder ?? null,
|
|
292
|
-
parentServiceId: service.parentServiceId || null,
|
|
293
|
-
isSetupFormation: service.isSetupFormation,
|
|
294
|
-
optionGroupId: service.optionGroupId || null,
|
|
295
|
-
facetBindings: (service.facetBindings || []).map((binding) => ({
|
|
296
|
-
id: binding.id,
|
|
297
|
-
facetName: binding.facetName,
|
|
298
|
-
facetType: binding.facetType,
|
|
299
|
-
supportedOptions: binding.supportedOptions,
|
|
300
|
-
})),
|
|
301
|
-
})),
|
|
302
|
-
optionGroups: (state.optionGroups || []).map((group) => ({
|
|
303
|
-
id: group.id,
|
|
304
|
-
name: group.name,
|
|
305
|
-
description: group.description || null,
|
|
306
|
-
isAddOn: group.isAddOn,
|
|
307
|
-
defaultSelected: group.defaultSelected,
|
|
308
|
-
})),
|
|
309
|
-
faqFields: (state.faqFields || []).map((faq) => ({
|
|
310
|
-
id: faq.id,
|
|
311
|
-
question: faq.question || null,
|
|
312
|
-
answer: faq.answer || null,
|
|
313
|
-
displayOrder: faq.displayOrder,
|
|
314
|
-
})),
|
|
315
|
-
contentSections: state.contentSections.map((section) => ({
|
|
316
|
-
id: section.id,
|
|
317
|
-
title: section.title,
|
|
318
|
-
content: section.content,
|
|
319
|
-
displayOrder: section.displayOrder,
|
|
320
|
-
})),
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Populate a resource-instance document with data from a resource-template.
|
|
325
|
-
* Initializes basic info and sets facet configuration from template facetTargets.
|
|
326
|
-
*/
|
|
327
|
-
async function populateResourceInstance(reactor, resourceInstanceDocId, resourceTemplateId, profileId, name) {
|
|
328
|
-
const resourceTemplateDoc = await reactor.getDocument(resourceTemplateId);
|
|
329
|
-
if (!resourceTemplateDoc)
|
|
330
|
-
return;
|
|
331
|
-
const templateState = resourceTemplateDoc.state.global;
|
|
332
|
-
// Initialize instance with basic info from template
|
|
333
|
-
await reactor.addAction(resourceInstanceDocId, ResourceInstance.actions.initializeInstance({
|
|
334
|
-
profileId,
|
|
335
|
-
profileDocumentType: "powerhouse/builder-profile",
|
|
336
|
-
resourceTemplateId,
|
|
337
|
-
customerId: null,
|
|
338
|
-
name,
|
|
339
|
-
thumbnailUrl: templateState.thumbnailUrl,
|
|
340
|
-
infoLink: templateState.infoLink,
|
|
341
|
-
description: templateState.description,
|
|
342
|
-
}));
|
|
343
|
-
// Populate facet configuration from template's facetTargets
|
|
344
|
-
for (const facetTarget of templateState.facetTargets) {
|
|
345
|
-
if (facetTarget.selectedOptions.length > 0) {
|
|
346
|
-
await reactor.addAction(resourceInstanceDocId, ResourceInstance.actions.setInstanceFacet({
|
|
347
|
-
id: facetTarget.id,
|
|
348
|
-
categoryKey: facetTarget.categoryKey,
|
|
349
|
-
categoryLabel: facetTarget.categoryLabel,
|
|
350
|
-
selectedOption: facetTarget.selectedOptions[0],
|
|
351
|
-
}));
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Map ServiceOfferingState from document model to GraphQL response
|
|
357
|
-
*/
|
|
358
|
-
function mapServiceOfferingState(state, doc) {
|
|
359
|
-
return {
|
|
360
|
-
id: doc.header.id,
|
|
361
|
-
operatorId: state.operatorId,
|
|
362
|
-
resourceTemplateId: state.resourceTemplateId || null,
|
|
363
|
-
title: state.title,
|
|
364
|
-
summary: state.summary,
|
|
365
|
-
description: state.description || null,
|
|
366
|
-
thumbnailUrl: state.thumbnailUrl || null,
|
|
367
|
-
infoLink: state.infoLink || null,
|
|
368
|
-
status: state.status,
|
|
369
|
-
lastModified: state.lastModified,
|
|
370
|
-
targetAudiences: state.targetAudiences.map((audience) => ({
|
|
371
|
-
id: audience.id,
|
|
372
|
-
label: audience.label,
|
|
373
|
-
color: audience.color || null,
|
|
374
|
-
})),
|
|
375
|
-
facetTargets: state.facetTargets.map((facet) => ({
|
|
376
|
-
id: facet.id,
|
|
377
|
-
categoryKey: facet.categoryKey,
|
|
378
|
-
categoryLabel: facet.categoryLabel,
|
|
379
|
-
selectedOptions: facet.selectedOptions,
|
|
380
|
-
})),
|
|
381
|
-
serviceGroups: (state.serviceGroups || []).map((group) => ({
|
|
382
|
-
id: group.id,
|
|
383
|
-
name: group.name,
|
|
384
|
-
description: group.description || null,
|
|
385
|
-
billingCycle: group.billingCycle,
|
|
386
|
-
displayOrder: group.displayOrder ?? null,
|
|
387
|
-
})),
|
|
388
|
-
services: state.services.map((service) => ({
|
|
389
|
-
id: service.id,
|
|
390
|
-
title: service.title,
|
|
391
|
-
description: service.description || null,
|
|
392
|
-
displayOrder: service.displayOrder ?? null,
|
|
393
|
-
serviceGroupId: service.serviceGroupId || null,
|
|
394
|
-
isSetupFormation: service.isSetupFormation,
|
|
395
|
-
optionGroupId: service.optionGroupId || null,
|
|
396
|
-
costType: service.costType || null,
|
|
397
|
-
price: service.price ?? null,
|
|
398
|
-
currency: service.currency || null,
|
|
399
|
-
facetBindings: (service.facetBindings || []).map((binding) => ({
|
|
400
|
-
id: binding.id,
|
|
401
|
-
facetName: binding.facetName,
|
|
402
|
-
facetType: binding.facetType,
|
|
403
|
-
supportedOptions: binding.supportedOptions,
|
|
404
|
-
})),
|
|
405
|
-
})),
|
|
406
|
-
tiers: state.tiers.map((tier) => ({
|
|
407
|
-
id: tier.id,
|
|
408
|
-
name: tier.name,
|
|
409
|
-
description: tier.description || null,
|
|
410
|
-
isCustomPricing: tier.isCustomPricing,
|
|
411
|
-
pricing: {
|
|
412
|
-
amount: tier.pricing.amount ?? null,
|
|
413
|
-
currency: tier.pricing.currency,
|
|
414
|
-
},
|
|
415
|
-
pricingOptions: tier.pricingOptions.map((option) => ({
|
|
416
|
-
id: option.id,
|
|
417
|
-
amount: option.amount,
|
|
418
|
-
currency: option.currency,
|
|
419
|
-
isDefault: option.isDefault,
|
|
420
|
-
})),
|
|
421
|
-
serviceLevels: tier.serviceLevels.map((level) => ({
|
|
422
|
-
id: level.id,
|
|
423
|
-
serviceId: level.serviceId,
|
|
424
|
-
level: level.level,
|
|
425
|
-
customValue: level.customValue || null,
|
|
426
|
-
optionGroupId: level.optionGroupId || null,
|
|
427
|
-
})),
|
|
428
|
-
usageLimits: tier.usageLimits.map((limit) => ({
|
|
429
|
-
id: limit.id,
|
|
430
|
-
serviceId: limit.serviceId,
|
|
431
|
-
metric: limit.metric,
|
|
432
|
-
unitName: limit.unitName || null,
|
|
433
|
-
freeLimit: limit.freeLimit ?? null,
|
|
434
|
-
paidLimit: limit.paidLimit ?? null,
|
|
435
|
-
resetCycle: limit.resetCycle || null,
|
|
436
|
-
notes: limit.notes || null,
|
|
437
|
-
unitPrice: limit.unitPrice ?? null,
|
|
438
|
-
unitPriceCurrency: limit.unitPriceCurrency || null,
|
|
439
|
-
})),
|
|
440
|
-
})),
|
|
441
|
-
optionGroups: state.optionGroups.map((group) => ({
|
|
442
|
-
id: group.id,
|
|
443
|
-
name: group.name,
|
|
444
|
-
description: group.description || null,
|
|
445
|
-
isAddOn: group.isAddOn,
|
|
446
|
-
defaultSelected: group.defaultSelected,
|
|
447
|
-
costType: group.costType || null,
|
|
448
|
-
billingCycle: group.billingCycle || null,
|
|
449
|
-
price: group.price ?? null,
|
|
450
|
-
currency: group.currency || null,
|
|
451
|
-
})),
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
async function getOperatorDrive(reactor, resourceTemplateId) {
|
|
455
|
-
const drives = await reactor.getDrives();
|
|
456
|
-
const results = await Promise.all(drives.map(async (drive) => {
|
|
457
|
-
const docIds = await reactor.getDocuments(drive);
|
|
458
|
-
return docIds.includes(resourceTemplateId) ? drive : null;
|
|
459
|
-
}));
|
|
460
|
-
const driveId = results.find((id) => id !== null);
|
|
461
|
-
return driveId ? reactor.getDrive(driveId) : undefined;
|
|
462
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../subgraphs/resources-services/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,MAAM,EAAE,YA0RpB,CAAC"}
|