@adaptic/backend-legacy 0.0.42 → 0.0.43

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptic/backend-legacy",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "description": "Backend executable CRUD functions with dynamic variables construction, and type definitions for the Adaptic AI platform.",
5
5
  "type": "module",
6
6
  "types": "index.d.ts",
@@ -19,6 +19,7 @@
19
19
  "generated/typeStrings",
20
20
  "esm/",
21
21
  "server/",
22
+ "resolvers/",
22
23
  "*.d.ts",
23
24
  "*.js",
24
25
  "*.cjs",
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
45
+ return function (target, key) { decorator(target, key, paramIndex); }
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.OptionsGreeksHistoryCustomResolver = void 0;
49
+ const TypeGraphQL = __importStar(require("type-graphql"));
50
+ const PortfolioGreeksHistory_1 = require("../../generated/typegraphql-prisma/models/PortfolioGreeksHistory");
51
+ const OptionsGreeksHistorySystemSummary_1 = require("./OptionsGreeksHistorySystemSummary.cjs");
52
+ const helpers_1 = require("../../generated/typegraphql-prisma/helpers");
53
+ /**
54
+ * Custom resolver for PortfolioGreeksHistory aggregation queries
55
+ * Provides system-wide analytics and summary statistics
56
+ * Note: GraphQL query name remains 'optionsGreeksHistorySystemSummary' for backwards compatibility
57
+ */
58
+ let OptionsGreeksHistoryCustomResolver = class OptionsGreeksHistoryCustomResolver {
59
+ /**
60
+ * Get system-wide summary statistics for OptionsGreeksHistory
61
+ * Executes aggregation query to get total accounts, snapshots, and time range
62
+ */
63
+ async optionsGreeksHistorySystemSummary(ctx) {
64
+ const prisma = (0, helpers_1.getPrismaFromContext)(ctx);
65
+ // Execute aggregation query
66
+ // This is equivalent to:
67
+ // SELECT
68
+ // COUNT(DISTINCT account_id) as total_accounts,
69
+ // COUNT(*) as total_snapshots,
70
+ // MIN(timestamp) as oldest_snapshot,
71
+ // MAX(timestamp) as newest_snapshot
72
+ // FROM portfolio_greeks_history
73
+ const [aggregateResult, totalCount] = await Promise.all([
74
+ prisma.portfolioGreeksHistory.aggregate({
75
+ _min: {
76
+ timestamp: true,
77
+ },
78
+ _max: {
79
+ timestamp: true,
80
+ },
81
+ }),
82
+ prisma.portfolioGreeksHistory.count(),
83
+ ]);
84
+ // Get distinct account count from the new schema
85
+ const distinctAccounts = await prisma.portfolioGreeksHistory.groupBy({
86
+ by: ['accountId'],
87
+ _count: {
88
+ accountId: true,
89
+ },
90
+ });
91
+ return {
92
+ totalAccounts: distinctAccounts.length,
93
+ totalSnapshots: totalCount,
94
+ oldestSnapshot: aggregateResult._min.timestamp,
95
+ newestSnapshot: aggregateResult._max.timestamp,
96
+ };
97
+ }
98
+ };
99
+ exports.OptionsGreeksHistoryCustomResolver = OptionsGreeksHistoryCustomResolver;
100
+ __decorate([
101
+ TypeGraphQL.Query(_returns => OptionsGreeksHistorySystemSummary_1.OptionsGreeksHistorySystemSummary, {
102
+ nullable: false,
103
+ description: 'Get system-wide summary statistics for Greeks history data',
104
+ }),
105
+ __param(0, TypeGraphQL.Ctx()),
106
+ __metadata("design:type", Function),
107
+ __metadata("design:paramtypes", [Object]),
108
+ __metadata("design:returntype", Promise)
109
+ ], OptionsGreeksHistoryCustomResolver.prototype, "optionsGreeksHistorySystemSummary", null);
110
+ exports.OptionsGreeksHistoryCustomResolver = OptionsGreeksHistoryCustomResolver = __decorate([
111
+ TypeGraphQL.Resolver(_of => PortfolioGreeksHistory_1.PortfolioGreeksHistory)
112
+ ], OptionsGreeksHistoryCustomResolver);
113
+ //# sourceMappingURL=OptionsGreeksHistoryCustomResolver.js.map
@@ -0,0 +1,14 @@
1
+ import { OptionsGreeksHistorySystemSummary } from './OptionsGreeksHistorySystemSummary';
2
+ /**
3
+ * Custom resolver for PortfolioGreeksHistory aggregation queries
4
+ * Provides system-wide analytics and summary statistics
5
+ * Note: GraphQL query name remains 'optionsGreeksHistorySystemSummary' for backwards compatibility
6
+ */
7
+ export declare class OptionsGreeksHistoryCustomResolver {
8
+ /**
9
+ * Get system-wide summary statistics for OptionsGreeksHistory
10
+ * Executes aggregation query to get total accounts, snapshots, and time range
11
+ */
12
+ optionsGreeksHistorySystemSummary(ctx: any): Promise<OptionsGreeksHistorySystemSummary>;
13
+ }
14
+ //# sourceMappingURL=OptionsGreeksHistoryCustomResolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionsGreeksHistoryCustomResolver.d.ts","sourceRoot":"","sources":["../../../src/resolvers/custom/OptionsGreeksHistoryCustomResolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAGxF;;;;GAIG;AACH,qBACa,kCAAkC;IAC7C;;;OAGG;IAKG,iCAAiC,CAClB,GAAG,EAAE,GAAG,GAC1B,OAAO,CAAC,iCAAiC,CAAC;CAsC9C"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionsGreeksHistoryCustomResolver.js","sourceRoot":"","sources":["../../../src/resolvers/custom/OptionsGreeksHistoryCustomResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4C;AAC5C,6GAA0G;AAC1G,2FAAwF;AACxF,wEAAkF;AAElF;;;;GAIG;AAEI,IAAM,kCAAkC,GAAxC,MAAM,kCAAkC;IAC7C;;;OAGG;IAKG,AAAN,KAAK,CAAC,iCAAiC,CAClB,GAAQ;QAE3B,MAAM,MAAM,GAAG,IAAA,8BAAoB,EAAC,GAAG,CAAC,CAAC;QAEzC,4BAA4B;QAC5B,yBAAyB;QACzB,SAAS;QACT,kDAAkD;QAClD,iCAAiC;QACjC,uCAAuC;QACvC,sCAAsC;QACtC,gCAAgC;QAChC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACtD,MAAM,CAAC,sBAAsB,CAAC,SAAS,CAAC;gBACtC,IAAI,EAAE;oBACJ,SAAS,EAAE,IAAI;iBAChB;gBACD,IAAI,EAAE;oBACJ,SAAS,EAAE,IAAI;iBAChB;aACF,CAAC;YACF,MAAM,CAAC,sBAAsB,CAAC,KAAK,EAAE;SACtC,CAAC,CAAC;QAEH,iDAAiD;QACjD,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC;YACnE,EAAE,EAAE,CAAC,WAAW,CAAC;YACjB,MAAM,EAAE;gBACN,SAAS,EAAE,IAAI;aAChB;SACF,CAAC,CAAC;QAEH,OAAO;YACL,aAAa,EAAE,gBAAgB,CAAC,MAAM;YACtC,cAAc,EAAE,UAAU;YAC1B,cAAc,EAAE,eAAe,CAAC,IAAI,CAAC,SAAS;YAC9C,cAAc,EAAE,eAAe,CAAC,IAAI,CAAC,SAAS;SAC/C,CAAC;IACJ,CAAC;CACF,CAAA;AAjDY,gFAAkC;AASvC;IAJL,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,qEAAiC,EAAE;QAChE,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,4DAA4D;KAC1E,CAAC;IAEC,WAAA,WAAW,CAAC,GAAG,EAAE,CAAA;;;;2FAsCnB;6CAhDU,kCAAkC;IAD9C,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,+CAAsB,CAAC;GACvC,kCAAkC,CAiD9C"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.OptionsGreeksHistorySystemSummary = void 0;
46
+ const TypeGraphQL = __importStar(require("type-graphql"));
47
+ /**
48
+ * System-wide summary statistics for OptionsGreeksHistory data
49
+ */
50
+ let OptionsGreeksHistorySystemSummary = class OptionsGreeksHistorySystemSummary {
51
+ };
52
+ exports.OptionsGreeksHistorySystemSummary = OptionsGreeksHistorySystemSummary;
53
+ __decorate([
54
+ TypeGraphQL.Field(_type => TypeGraphQL.Int, {
55
+ nullable: false,
56
+ description: 'Total number of unique accounts with Greeks history',
57
+ }),
58
+ __metadata("design:type", Number)
59
+ ], OptionsGreeksHistorySystemSummary.prototype, "totalAccounts", void 0);
60
+ __decorate([
61
+ TypeGraphQL.Field(_type => TypeGraphQL.Int, {
62
+ nullable: false,
63
+ description: 'Total number of Greeks snapshots across all accounts',
64
+ }),
65
+ __metadata("design:type", Number)
66
+ ], OptionsGreeksHistorySystemSummary.prototype, "totalSnapshots", void 0);
67
+ __decorate([
68
+ TypeGraphQL.Field(_type => Date, {
69
+ nullable: true,
70
+ description: 'Timestamp of the oldest Greeks snapshot in the system',
71
+ }),
72
+ __metadata("design:type", Object)
73
+ ], OptionsGreeksHistorySystemSummary.prototype, "oldestSnapshot", void 0);
74
+ __decorate([
75
+ TypeGraphQL.Field(_type => Date, {
76
+ nullable: true,
77
+ description: 'Timestamp of the newest Greeks snapshot in the system',
78
+ }),
79
+ __metadata("design:type", Object)
80
+ ], OptionsGreeksHistorySystemSummary.prototype, "newestSnapshot", void 0);
81
+ exports.OptionsGreeksHistorySystemSummary = OptionsGreeksHistorySystemSummary = __decorate([
82
+ TypeGraphQL.ObjectType('OptionsGreeksHistorySystemSummary', {})
83
+ ], OptionsGreeksHistorySystemSummary);
84
+ //# sourceMappingURL=OptionsGreeksHistorySystemSummary.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * System-wide summary statistics for OptionsGreeksHistory data
3
+ */
4
+ export declare class OptionsGreeksHistorySystemSummary {
5
+ totalAccounts: number;
6
+ totalSnapshots: number;
7
+ oldestSnapshot: Date | null;
8
+ newestSnapshot: Date | null;
9
+ }
10
+ //# sourceMappingURL=OptionsGreeksHistorySystemSummary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionsGreeksHistorySystemSummary.d.ts","sourceRoot":"","sources":["../../../src/resolvers/custom/OptionsGreeksHistorySystemSummary.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBACa,iCAAiC;IAK5C,aAAa,EAAG,MAAM,CAAC;IAMvB,cAAc,EAAG,MAAM,CAAC;IAMxB,cAAc,EAAG,IAAI,GAAG,IAAI,CAAC;IAM7B,cAAc,EAAG,IAAI,GAAG,IAAI,CAAC;CAC9B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionsGreeksHistorySystemSummary.js","sourceRoot":"","sources":["../../../src/resolvers/custom/OptionsGreeksHistorySystemSummary.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA4C;AAE5C;;GAEG;AAEI,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;CAwB7C,CAAA;AAxBY,8EAAiC;AAK5C;IAJC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE;QAC3C,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,qDAAqD;KACnE,CAAC;;wEACqB;AAMvB;IAJC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE;QAC3C,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,sDAAsD;KACpE,CAAC;;yEACsB;AAMxB;IAJC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE;QAChC,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,uDAAuD;KACrE,CAAC;;yEAC2B;AAM7B;IAJC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE;QAChC,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,uDAAuD;KACrE,CAAC;;yEAC2B;4CAvBlB,iCAAiC;IAD7C,WAAW,CAAC,UAAU,CAAC,mCAAmC,EAAE,EAAE,CAAC;GACnD,iCAAiC,CAwB7C"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Custom resolvers for backend-legacy
4
+ * These resolvers extend the auto-generated TypeGraphQL Prisma resolvers
5
+ * with custom aggregation queries and business logic
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.OptionsGreeksHistorySystemSummary = exports.OptionsGreeksHistoryCustomResolver = void 0;
9
+ var OptionsGreeksHistoryCustomResolver_1 = require("./OptionsGreeksHistoryCustomResolver.cjs");
10
+ Object.defineProperty(exports, "OptionsGreeksHistoryCustomResolver", { enumerable: true, get: function () { return OptionsGreeksHistoryCustomResolver_1.OptionsGreeksHistoryCustomResolver; } });
11
+ var OptionsGreeksHistorySystemSummary_1 = require("./OptionsGreeksHistorySystemSummary.cjs");
12
+ Object.defineProperty(exports, "OptionsGreeksHistorySystemSummary", { enumerable: true, get: function () { return OptionsGreeksHistorySystemSummary_1.OptionsGreeksHistorySystemSummary; } });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Custom resolvers for backend-legacy
3
+ * These resolvers extend the auto-generated TypeGraphQL Prisma resolvers
4
+ * with custom aggregation queries and business logic
5
+ */
6
+ export { OptionsGreeksHistoryCustomResolver } from './OptionsGreeksHistoryCustomResolver';
7
+ export { OptionsGreeksHistorySystemSummary } from './OptionsGreeksHistorySystemSummary';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resolvers/custom/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resolvers/custom/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,2FAA0F;AAAjF,wJAAA,kCAAkC,OAAA;AAC3C,yFAAwF;AAA/E,sJAAA,iCAAiC,OAAA"}