@antelopejs/interface-dms-saas 0.0.1
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/LICENSE +190 -0
- package/README.md +51 -0
- package/dist/billing.d.ts +25 -0
- package/dist/billing.js +15 -0
- package/dist/billing.js.map +1 -0
- package/dist/data-api.d.ts +1 -0
- package/dist/data-api.js +6 -0
- package/dist/data-api.js.map +1 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.js +19 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/models/billingSettings.model.d.ts +22 -0
- package/dist/db/models/billingSettings.model.js +9 -0
- package/dist/db/models/billingSettings.model.js.map +1 -0
- package/dist/db/models/creditNotes.model.d.ts +25 -0
- package/dist/db/models/creditNotes.model.js +26 -0
- package/dist/db/models/creditNotes.model.js.map +1 -0
- package/dist/db/models/features.model.d.ts +22 -0
- package/dist/db/models/features.model.js +9 -0
- package/dist/db/models/features.model.js.map +1 -0
- package/dist/db/models/index.d.ts +19 -0
- package/dist/db/models/index.js +36 -0
- package/dist/db/models/index.js.map +1 -0
- package/dist/db/models/invoices.model.d.ts +29 -0
- package/dist/db/models/invoices.model.js +60 -0
- package/dist/db/models/invoices.model.js.map +1 -0
- package/dist/db/models/legalDocuments.model.d.ts +22 -0
- package/dist/db/models/legalDocuments.model.js +9 -0
- package/dist/db/models/legalDocuments.model.js.map +1 -0
- package/dist/db/models/planMigrations.model.d.ts +29 -0
- package/dist/db/models/planMigrations.model.js +70 -0
- package/dist/db/models/planMigrations.model.js.map +1 -0
- package/dist/db/models/plans.model.d.ts +31 -0
- package/dist/db/models/plans.model.js +74 -0
- package/dist/db/models/plans.model.js.map +1 -0
- package/dist/db/models/platformNotes.model.d.ts +33 -0
- package/dist/db/models/platformNotes.model.js +27 -0
- package/dist/db/models/platformNotes.model.js.map +1 -0
- package/dist/db/models/refunds.model.d.ts +23 -0
- package/dist/db/models/refunds.model.js +17 -0
- package/dist/db/models/refunds.model.js.map +1 -0
- package/dist/db/models/revision.d.ts +1 -0
- package/dist/db/models/revision.js +14 -0
- package/dist/db/models/revision.js.map +1 -0
- package/dist/db/models/segments.model.d.ts +29 -0
- package/dist/db/models/segments.model.js +81 -0
- package/dist/db/models/segments.model.js.map +1 -0
- package/dist/db/models/stripeWebhookEvents.model.d.ts +26 -0
- package/dist/db/models/stripeWebhookEvents.model.js +70 -0
- package/dist/db/models/stripeWebhookEvents.model.js.map +1 -0
- package/dist/db/models/supportMessages.model.d.ts +23 -0
- package/dist/db/models/supportMessages.model.js +17 -0
- package/dist/db/models/supportMessages.model.js.map +1 -0
- package/dist/db/models/supportTicketEvents.model.d.ts +22 -0
- package/dist/db/models/supportTicketEvents.model.js +9 -0
- package/dist/db/models/supportTicketEvents.model.js.map +1 -0
- package/dist/db/models/supportTickets.model.d.ts +25 -0
- package/dist/db/models/supportTickets.model.js +32 -0
- package/dist/db/models/supportTickets.model.js.map +1 -0
- package/dist/db/models/tenantBillingInfo.model.d.ts +24 -0
- package/dist/db/models/tenantBillingInfo.model.js +20 -0
- package/dist/db/models/tenantBillingInfo.model.js.map +1 -0
- package/dist/db/models/tenantBillingState.model.d.ts +28 -0
- package/dist/db/models/tenantBillingState.model.js +72 -0
- package/dist/db/models/tenantBillingState.model.js.map +1 -0
- package/dist/db/models/tenantSubscriptions.model.d.ts +51 -0
- package/dist/db/models/tenantSubscriptions.model.js +305 -0
- package/dist/db/models/tenantSubscriptions.model.js.map +1 -0
- package/dist/db/models/trialConsumptions.model.d.ts +24 -0
- package/dist/db/models/trialConsumptions.model.js +30 -0
- package/dist/db/models/trialConsumptions.model.js.map +1 -0
- package/dist/db/models/update-result.d.ts +1 -0
- package/dist/db/models/update-result.js +13 -0
- package/dist/db/models/update-result.js.map +1 -0
- package/dist/db/models/userSegments.model.d.ts +30 -0
- package/dist/db/models/userSegments.model.js +97 -0
- package/dist/db/models/userSegments.model.js.map +1 -0
- package/dist/db/tables/billingSettings.table.d.ts +22 -0
- package/dist/db/tables/billingSettings.table.js +73 -0
- package/dist/db/tables/billingSettings.table.js.map +1 -0
- package/dist/db/tables/creditNotes.table.d.ts +26 -0
- package/dist/db/tables/creditNotes.table.js +110 -0
- package/dist/db/tables/creditNotes.table.js.map +1 -0
- package/dist/db/tables/features.table.d.ts +18 -0
- package/dist/db/tables/features.table.js +70 -0
- package/dist/db/tables/features.table.js.map +1 -0
- package/dist/db/tables/index.d.ts +19 -0
- package/dist/db/tables/index.js +36 -0
- package/dist/db/tables/index.js.map +1 -0
- package/dist/db/tables/invoices.table.d.ts +47 -0
- package/dist/db/tables/invoices.table.js +140 -0
- package/dist/db/tables/invoices.table.js.map +1 -0
- package/dist/db/tables/legalDocuments.table.d.ts +10 -0
- package/dist/db/tables/legalDocuments.table.js +44 -0
- package/dist/db/tables/legalDocuments.table.js.map +1 -0
- package/dist/db/tables/planMigrations.table.d.ts +61 -0
- package/dist/db/tables/planMigrations.table.js +114 -0
- package/dist/db/tables/planMigrations.table.js.map +1 -0
- package/dist/db/tables/plans.table.d.ts +41 -0
- package/dist/db/tables/plans.table.js +125 -0
- package/dist/db/tables/plans.table.js.map +1 -0
- package/dist/db/tables/platformNotes.table.d.ts +13 -0
- package/dist/db/tables/platformNotes.table.js +58 -0
- package/dist/db/tables/platformNotes.table.js.map +1 -0
- package/dist/db/tables/refunds.table.d.ts +15 -0
- package/dist/db/tables/refunds.table.js +70 -0
- package/dist/db/tables/refunds.table.js.map +1 -0
- package/dist/db/tables/segments.table.d.ts +37 -0
- package/dist/db/tables/segments.table.js +79 -0
- package/dist/db/tables/segments.table.js.map +1 -0
- package/dist/db/tables/stripeWebhookEvents.table.d.ts +12 -0
- package/dist/db/tables/stripeWebhookEvents.table.js +54 -0
- package/dist/db/tables/stripeWebhookEvents.table.js.map +1 -0
- package/dist/db/tables/supportMessages.table.d.ts +14 -0
- package/dist/db/tables/supportMessages.table.js +62 -0
- package/dist/db/tables/supportMessages.table.js.map +1 -0
- package/dist/db/tables/supportTicketEvents.table.d.ts +14 -0
- package/dist/db/tables/supportTicketEvents.table.js +61 -0
- package/dist/db/tables/supportTicketEvents.table.js.map +1 -0
- package/dist/db/tables/supportTickets.table.d.ts +25 -0
- package/dist/db/tables/supportTickets.table.js +109 -0
- package/dist/db/tables/supportTickets.table.js.map +1 -0
- package/dist/db/tables/tenantBillingInfo.table.d.ts +24 -0
- package/dist/db/tables/tenantBillingInfo.table.js +62 -0
- package/dist/db/tables/tenantBillingInfo.table.js.map +1 -0
- package/dist/db/tables/tenantBillingState.table.d.ts +12 -0
- package/dist/db/tables/tenantBillingState.table.js +59 -0
- package/dist/db/tables/tenantBillingState.table.js.map +1 -0
- package/dist/db/tables/tenantSubscriptions.table.d.ts +46 -0
- package/dist/db/tables/tenantSubscriptions.table.js +157 -0
- package/dist/db/tables/tenantSubscriptions.table.js.map +1 -0
- package/dist/db/tables/trialConsumptions.table.d.ts +10 -0
- package/dist/db/tables/trialConsumptions.table.js +55 -0
- package/dist/db/tables/trialConsumptions.table.js.map +1 -0
- package/dist/db/tables/userSegments.table.d.ts +11 -0
- package/dist/db/tables/userSegments.table.js +56 -0
- package/dist/db/tables/userSegments.table.js.map +1 -0
- package/dist/hidden-filter.d.ts +1 -0
- package/dist/hidden-filter.js +10 -0
- package/dist/hidden-filter.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/invoice-line-items.d.ts +42 -0
- package/dist/invoice-line-items.js +83 -0
- package/dist/invoice-line-items.js.map +1 -0
- package/dist/page-definitions.d.ts +17 -0
- package/dist/page-definitions.js +60 -0
- package/dist/page-definitions.js.map +1 -0
- package/dist/pages.d.ts +59 -0
- package/dist/pages.js +88 -0
- package/dist/pages.js.map +1 -0
- package/dist/plans.d.ts +27 -0
- package/dist/plans.js +60 -0
- package/dist/plans.js.map +1 -0
- package/dist/provisioning.d.ts +5 -0
- package/dist/provisioning.js +3 -0
- package/dist/provisioning.js.map +1 -0
- package/dist/registration.d.ts +6 -0
- package/dist/registration.js +9 -0
- package/dist/registration.js.map +1 -0
- package/dist/workspace-lifecycle.d.ts +27 -0
- package/dist/workspace-lifecycle.js +30 -0
- package/dist/workspace-lifecycle.js.map +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LegalDocuments } from "../tables/legalDocuments.table";
|
|
2
|
+
declare const LegalDocumentsModel_base: {
|
|
3
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
4
|
+
readonly table: import("@antelopejs/interface-database").Table<LegalDocuments>;
|
|
5
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
6
|
+
get(id: string): PromiseLike<LegalDocuments | undefined>;
|
|
7
|
+
getBy(index: keyof LegalDocuments, ...keys: any[]): PromiseLike<LegalDocuments[]>;
|
|
8
|
+
getAll(): PromiseLike<LegalDocuments[]>;
|
|
9
|
+
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<LegalDocuments> | import("@antelopejs/interface-database-decorators").DeepPartial<LegalDocuments>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
10
|
+
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<LegalDocuments>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
11
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<LegalDocuments>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
|
+
delete(id: string): Promise<number>;
|
|
13
|
+
};
|
|
14
|
+
readonly schemaName: string;
|
|
15
|
+
fromPlainData(obj: any): LegalDocuments;
|
|
16
|
+
fromDatabase(obj: any): LegalDocuments | undefined;
|
|
17
|
+
toDatabase(obj: any): Record<string, any>;
|
|
18
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
19
|
+
};
|
|
20
|
+
export declare class LegalDocumentsModel extends LegalDocumentsModel_base {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LegalDocumentsModel = void 0;
|
|
4
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
5
|
+
const legalDocuments_table_1 = require("../tables/legalDocuments.table");
|
|
6
|
+
class LegalDocumentsModel extends (0, interface_database_decorators_1.BasicDataModel)(legalDocuments_table_1.LegalDocuments, legalDocuments_table_1.legalDocumentsTableName) {
|
|
7
|
+
}
|
|
8
|
+
exports.LegalDocumentsModel = LegalDocumentsModel;
|
|
9
|
+
//# sourceMappingURL=legalDocuments.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legalDocuments.model.js","sourceRoot":"","sources":["../../../src/db/models/legalDocuments.model.ts"],"names":[],"mappings":";;;AAAA,6FAA2E;AAC3E,yEAGwC;AAGxC,MAAa,mBAAoB,SAAQ,IAAA,8CAAc,EACrD,qCAAc,EACd,8CAAuB,CACxB;CAAG;AAHJ,kDAGI"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type DeepPartial, type ValidateOptions } from "@antelopejs/interface-database-decorators";
|
|
2
|
+
import { PlanMigration, type PlanMigrationSnapshot } from "../tables/planMigrations.table";
|
|
3
|
+
declare const PlanMigrationModel_base: {
|
|
4
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
5
|
+
readonly table: import("@antelopejs/interface-database").Table<PlanMigration>;
|
|
6
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
7
|
+
get(id: string): PromiseLike<PlanMigration | undefined>;
|
|
8
|
+
getBy(index: keyof PlanMigration, ...keys: any[]): PromiseLike<PlanMigration[]>;
|
|
9
|
+
getAll(): PromiseLike<PlanMigration[]>;
|
|
10
|
+
insert(obj: DeepPartial<PlanMigration> | DeepPartial<PlanMigration>[], options?: ValidateOptions): Promise<string[]>;
|
|
11
|
+
update(id: string, obj: DeepPartial<PlanMigration>, options?: ValidateOptions): Promise<number>;
|
|
12
|
+
update(obj: DeepPartial<PlanMigration>, options?: ValidateOptions): Promise<number>;
|
|
13
|
+
delete(id: string): Promise<number>;
|
|
14
|
+
};
|
|
15
|
+
readonly schemaName: string;
|
|
16
|
+
fromPlainData(obj: any): PlanMigration;
|
|
17
|
+
fromDatabase(obj: any): PlanMigration | undefined;
|
|
18
|
+
toDatabase(obj: any): Record<string, any>;
|
|
19
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
20
|
+
};
|
|
21
|
+
export declare class PlanMigrationModel extends PlanMigrationModel_base {
|
|
22
|
+
insert(rows: DeepPartial<PlanMigration> | DeepPartial<PlanMigration>[], options?: ValidateOptions): Promise<string[]>;
|
|
23
|
+
beginJob(job: PlanMigration, snapshot: PlanMigrationSnapshot): Promise<boolean>;
|
|
24
|
+
checkpoint(job: PlanMigration, patch: Partial<PlanMigration>): Promise<void>;
|
|
25
|
+
private persist;
|
|
26
|
+
findResumable(): Promise<PlanMigration[]>;
|
|
27
|
+
existsPendingOrRunningForPlan(fromPlanId: string): Promise<boolean>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlanMigrationModel = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
6
|
+
const planMigrations_table_1 = require("../tables/planMigrations.table");
|
|
7
|
+
class PlanMigrationModel extends (0, interface_database_decorators_1.BasicDataModel)(planMigrations_table_1.PlanMigration, planMigrations_table_1.planMigrationsTableName) {
|
|
8
|
+
insert(rows, options) {
|
|
9
|
+
const initialize = (row) => ({
|
|
10
|
+
...row,
|
|
11
|
+
revision: (0, node_crypto_1.randomUUID)(),
|
|
12
|
+
tenantOutcomes: [],
|
|
13
|
+
});
|
|
14
|
+
return super.insert(Array.isArray(rows) ? rows.map(initialize) : initialize(rows), options);
|
|
15
|
+
}
|
|
16
|
+
async beginJob(job, snapshot) {
|
|
17
|
+
if (job.status !== "pending")
|
|
18
|
+
return false;
|
|
19
|
+
return this.persist(job, {
|
|
20
|
+
snapshot,
|
|
21
|
+
totalWorkspaces: snapshot.tenantIds.length,
|
|
22
|
+
status: "running",
|
|
23
|
+
startedAt: new Date(),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async checkpoint(job, patch) {
|
|
27
|
+
if (job.status !== "running" || !(await this.persist(job, patch)))
|
|
28
|
+
throw new Error("Migration progress changed; reconciliation required");
|
|
29
|
+
}
|
|
30
|
+
async persist(job, patch) {
|
|
31
|
+
const nextRevision = (0, node_crypto_1.randomUUID)();
|
|
32
|
+
const outcome = await this.table
|
|
33
|
+
.atomicMutation(job._id, {
|
|
34
|
+
type: "update",
|
|
35
|
+
revisionField: "revision",
|
|
36
|
+
expectedRevision: job.revision === undefined ? { kind: "missing" } : job.revision,
|
|
37
|
+
nextRevision,
|
|
38
|
+
patch,
|
|
39
|
+
})
|
|
40
|
+
.run();
|
|
41
|
+
if (outcome === "unknown")
|
|
42
|
+
throw new Error("Migration acknowledgement unknown; reconciliation required");
|
|
43
|
+
if (outcome !== "applied")
|
|
44
|
+
return false;
|
|
45
|
+
Object.assign(job, patch, { revision: nextRevision });
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
async findResumable() {
|
|
49
|
+
const rows = await this.table
|
|
50
|
+
.getAll(["pending", "running"], "status")
|
|
51
|
+
.run();
|
|
52
|
+
return rows
|
|
53
|
+
.map((row) => PlanMigrationModel.fromDatabase(row))
|
|
54
|
+
.filter((row) => row !== undefined);
|
|
55
|
+
}
|
|
56
|
+
async existsPendingOrRunningForPlan(fromPlanId) {
|
|
57
|
+
const count = await this.table
|
|
58
|
+
.getAll(fromPlanId, "fromPlanId")
|
|
59
|
+
.filter((row) => row
|
|
60
|
+
.key("status")
|
|
61
|
+
.eq("pending")
|
|
62
|
+
.or(row.key("status").eq("running"))
|
|
63
|
+
.or(row.key("status").eq("reconciliation_required")))
|
|
64
|
+
.count()
|
|
65
|
+
.run();
|
|
66
|
+
return count > 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.PlanMigrationModel = PlanMigrationModel;
|
|
70
|
+
//# sourceMappingURL=planMigrations.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planMigrations.model.js","sourceRoot":"","sources":["../../../src/db/models/planMigrations.model.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,6FAImD;AACnD,yEAIwC;AAGxC,MAAa,kBAAmB,SAAQ,IAAA,8CAAc,EACpD,oCAAa,EACb,8CAAuB,CACxB;IAEU,MAAM,CACb,IAA+D,EAC/D,OAAyB;QAEzB,MAAM,UAAU,GAAG,CACjB,GAA+B,EACH,EAAE,CAAC,CAAC;YAChC,GAAG,GAAG;YACN,QAAQ,EAAE,IAAA,wBAAU,GAAE;YACtB,cAAc,EAAE,EAAE;SACnB,CAAC,CAAC;QACH,OAAO,KAAK,CAAC,MAAM,CACjB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,EAC7D,OAAO,CACR,CAAC;IACJ,CAAC;IAGD,KAAK,CAAC,QAAQ,CACZ,GAAkB,EAClB,QAA+B;QAE/B,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YACvB,QAAQ;YACR,eAAe,EAAE,QAAQ,CAAC,SAAS,CAAC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CAAC,GAAG,EAAE,EAAE,CAAC,kBAAkB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;aAClD,MAAM,CAAC,CAAC,GAAG,EAAwB,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;IAC9D,CAAC;IAGD,KAAK,CAAC,6BAA6B,CAAC,UAAkB;QACpD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK;aAC3B,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC;aAChC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CACd,GAAG;aACA,GAAG,CAAC,QAAQ,CAAC;aACb,EAAE,CAAC,SAAS,CAAC;aACb,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;aACnC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAC,CACvD;aACA,KAAK,EAAE;aACP,GAAG,EAAE,CAAC;QACT,OAAO,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC;CACF;AA9FD,gDA8FC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Plan, type PlanFeatureValue } from "../tables/plans.table";
|
|
2
|
+
export interface ResolvedPlanInheritance {
|
|
3
|
+
permissions: string[];
|
|
4
|
+
features: PlanFeatureValue[];
|
|
5
|
+
}
|
|
6
|
+
declare const PlanModel_base: {
|
|
7
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
8
|
+
readonly table: import("@antelopejs/interface-database").Table<Plan>;
|
|
9
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
10
|
+
get(id: string): PromiseLike<Plan | undefined>;
|
|
11
|
+
getBy(index: keyof Plan, ...keys: any[]): PromiseLike<Plan[]>;
|
|
12
|
+
getAll(): PromiseLike<Plan[]>;
|
|
13
|
+
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Plan> | import("@antelopejs/interface-database-decorators").DeepPartial<Plan>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
14
|
+
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<Plan>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
15
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Plan>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
16
|
+
delete(id: string): Promise<number>;
|
|
17
|
+
};
|
|
18
|
+
readonly schemaName: string;
|
|
19
|
+
fromPlainData(obj: any): Plan;
|
|
20
|
+
fromDatabase(obj: any): Plan | undefined;
|
|
21
|
+
toDatabase(obj: any): Record<string, any>;
|
|
22
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
23
|
+
};
|
|
24
|
+
export declare class PlanModel extends PlanModel_base {
|
|
25
|
+
findNotDeleted(): Promise<Plan[]>;
|
|
26
|
+
findActiveNotDeleted(): Promise<Plan[]>;
|
|
27
|
+
findPubliclyVisible(): Promise<Plan[]>;
|
|
28
|
+
resolveInheritanceChain(plan: Plan): Promise<Plan[]>;
|
|
29
|
+
resolveInheritance(plan: Plan): Promise<ResolvedPlanInheritance>;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlanModel = void 0;
|
|
4
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
5
|
+
const plans_table_1 = require("../tables/plans.table");
|
|
6
|
+
const MAX_INHERITANCE_DEPTH = 10;
|
|
7
|
+
class PlanModel extends (0, interface_database_decorators_1.BasicDataModel)(plans_table_1.Plan, plans_table_1.plansTableName) {
|
|
8
|
+
async findNotDeleted() {
|
|
9
|
+
const rows = await this.table
|
|
10
|
+
.filter((row) => row.key("isDeleted").eq(false))
|
|
11
|
+
.run();
|
|
12
|
+
return rows
|
|
13
|
+
.map((row) => PlanModel.fromDatabase(row))
|
|
14
|
+
.filter((row) => row !== undefined);
|
|
15
|
+
}
|
|
16
|
+
async findActiveNotDeleted() {
|
|
17
|
+
const rows = await this.table
|
|
18
|
+
.filter((row) => row.key("isDeleted").eq(false).and(row.key("isActive").eq(true)))
|
|
19
|
+
.run();
|
|
20
|
+
return rows
|
|
21
|
+
.map((row) => PlanModel.fromDatabase(row))
|
|
22
|
+
.filter((row) => row !== undefined);
|
|
23
|
+
}
|
|
24
|
+
async findPubliclyVisible() {
|
|
25
|
+
const rows = await this.table
|
|
26
|
+
.filter((row) => row
|
|
27
|
+
.key("isDeleted")
|
|
28
|
+
.eq(false)
|
|
29
|
+
.and(row.key("isActive").eq(true))
|
|
30
|
+
.and(row.key("isPublic").eq(true)))
|
|
31
|
+
.run();
|
|
32
|
+
return rows
|
|
33
|
+
.map((row) => PlanModel.fromDatabase(row))
|
|
34
|
+
.filter((row) => row !== undefined);
|
|
35
|
+
}
|
|
36
|
+
async resolveInheritanceChain(plan) {
|
|
37
|
+
const visited = new Set();
|
|
38
|
+
const chain = [];
|
|
39
|
+
let current = plan;
|
|
40
|
+
while (current && !visited.has(current._id)) {
|
|
41
|
+
visited.add(current._id);
|
|
42
|
+
chain.push(current);
|
|
43
|
+
if (!current.inheritsFromPlanId)
|
|
44
|
+
break;
|
|
45
|
+
if (chain.length >= MAX_INHERITANCE_DEPTH)
|
|
46
|
+
break;
|
|
47
|
+
current = await this.get(current.inheritsFromPlanId);
|
|
48
|
+
}
|
|
49
|
+
return chain;
|
|
50
|
+
}
|
|
51
|
+
async resolveInheritance(plan) {
|
|
52
|
+
const chain = await this.resolveInheritanceChain(plan);
|
|
53
|
+
const permissions = new Set();
|
|
54
|
+
const featureMap = new Map();
|
|
55
|
+
for (let i = chain.length - 1; i >= 0; i--) {
|
|
56
|
+
const link = chain[i];
|
|
57
|
+
for (const permission of link.permissions ?? []) {
|
|
58
|
+
permissions.add(permission);
|
|
59
|
+
}
|
|
60
|
+
for (const feature of link.features ?? []) {
|
|
61
|
+
featureMap.set(feature.featureId, feature.value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
permissions: Array.from(permissions),
|
|
66
|
+
features: Array.from(featureMap).map(([featureId, value]) => ({
|
|
67
|
+
featureId,
|
|
68
|
+
value,
|
|
69
|
+
})),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.PlanModel = PlanModel;
|
|
74
|
+
//# sourceMappingURL=plans.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plans.model.js","sourceRoot":"","sources":["../../../src/db/models/plans.model.ts"],"names":[],"mappings":";;;AAAA,6FAA2E;AAC3E,uDAI+B;AAE/B,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAQjC,MAAa,SAAU,SAAQ,IAAA,8CAAc,EAAC,kBAAI,EAAE,4BAAc,CAAC;IACjE,KAAK,CAAC,cAAc;QAClB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK;aAC1B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;aAC/C,GAAG,EAAE,CAAC;QACT,OAAO,IAAI;aACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;aACzC,MAAM,CAAC,CAAC,GAAG,EAAe,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,oBAAoB;QACxB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK;aAC1B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CACd,GAAG,CAAC,GAAG,CAAC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aACN,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC;CACF;AAvED,8BAuEC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PlatformNote, type PlatformNoteTargetType } from "../tables/platformNotes.table";
|
|
2
|
+
export interface ListNotesOptions {
|
|
3
|
+
page?: number;
|
|
4
|
+
pageSize?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ListNotesResult {
|
|
7
|
+
items: PlatformNote[];
|
|
8
|
+
total: number;
|
|
9
|
+
page: number;
|
|
10
|
+
pageSize: number;
|
|
11
|
+
}
|
|
12
|
+
declare const PlatformNoteModel_base: {
|
|
13
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
14
|
+
readonly table: import("@antelopejs/interface-database").Table<PlatformNote>;
|
|
15
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
16
|
+
get(id: string): PromiseLike<PlatformNote | undefined>;
|
|
17
|
+
getBy(index: keyof PlatformNote, ...keys: any[]): PromiseLike<PlatformNote[]>;
|
|
18
|
+
getAll(): PromiseLike<PlatformNote[]>;
|
|
19
|
+
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<PlatformNote> | import("@antelopejs/interface-database-decorators").DeepPartial<PlatformNote>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
20
|
+
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<PlatformNote>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
21
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<PlatformNote>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
22
|
+
delete(id: string): Promise<number>;
|
|
23
|
+
};
|
|
24
|
+
readonly schemaName: string;
|
|
25
|
+
fromPlainData(obj: any): PlatformNote;
|
|
26
|
+
fromDatabase(obj: any): PlatformNote | undefined;
|
|
27
|
+
toDatabase(obj: any): Record<string, any>;
|
|
28
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
29
|
+
};
|
|
30
|
+
export declare class PlatformNoteModel extends PlatformNoteModel_base {
|
|
31
|
+
listByTarget(targetType: PlatformNoteTargetType, targetId: string, options?: ListNotesOptions): Promise<ListNotesResult>;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlatformNoteModel = void 0;
|
|
4
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
5
|
+
const platformNotes_table_1 = require("../tables/platformNotes.table");
|
|
6
|
+
const DEFAULT_PAGE_SIZE = 5;
|
|
7
|
+
const MAX_PAGE_SIZE = 50;
|
|
8
|
+
class PlatformNoteModel extends (0, interface_database_decorators_1.BasicDataModel)(platformNotes_table_1.PlatformNote, platformNotes_table_1.platformNotesTableName) {
|
|
9
|
+
async listByTarget(targetType, targetId, options = {}) {
|
|
10
|
+
const pageSize = Math.min(Math.max(options.pageSize ?? DEFAULT_PAGE_SIZE, 1), MAX_PAGE_SIZE);
|
|
11
|
+
const page = Math.max(options.page ?? 1, 1);
|
|
12
|
+
const offset = (page - 1) * pageSize;
|
|
13
|
+
const buildQuery = () => this.table
|
|
14
|
+
.getAll(targetId, "targetId")
|
|
15
|
+
.filter((row) => row.key("targetType").eq(targetType));
|
|
16
|
+
const [total, rows] = await Promise.all([
|
|
17
|
+
buildQuery().count().run(),
|
|
18
|
+
buildQuery().orderBy("createdAt", "desc").slice(offset, pageSize).run(),
|
|
19
|
+
]);
|
|
20
|
+
const items = rows
|
|
21
|
+
.map((row) => PlatformNoteModel.fromDatabase(row))
|
|
22
|
+
.filter((note) => note !== undefined);
|
|
23
|
+
return { items, total, page, pageSize };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.PlatformNoteModel = PlatformNoteModel;
|
|
27
|
+
//# sourceMappingURL=platformNotes.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platformNotes.model.js","sourceRoot":"","sources":["../../../src/db/models/platformNotes.model.ts"],"names":[],"mappings":";;;AAAA,6FAA2E;AAC3E,uEAIuC;AAEvC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,aAAa,GAAG,EAAE,CAAC;AAezB,MAAa,iBAAkB,SAAQ,IAAA,8CAAc,EACnD,kCAAY,EACZ,4CAAsB,CACvB;IACC,KAAK,CAAC,YAAY,CAChB,UAAkC,EAClC,QAAgB,EAChB,UAA4B,EAAE;QAE9B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CACvB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,iBAAiB,EAAE,CAAC,CAAC,EAClD,aAAa,CACd,CAAC;QACF,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5C,MAAM,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;QAErC,MAAM,UAAU,GAAG,GAAG,EAAE,CACtB,IAAI,CAAC,KAAK;aACP,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC;aAC5B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;QAE3D,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACtC,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE;YAC1B,UAAU,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE;SACxE,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,IAAI;aACf,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;aACjD,MAAM,CAAC,CAAC,IAAI,EAAwB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QAE9D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC1C,CAAC;CACF;AAhCD,8CAgCC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Refund } from "../tables/refunds.table";
|
|
2
|
+
declare const RefundModel_base: {
|
|
3
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
4
|
+
readonly table: import("@antelopejs/interface-database").Table<Refund>;
|
|
5
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
6
|
+
get(id: string): PromiseLike<Refund | undefined>;
|
|
7
|
+
getBy(index: keyof Refund, ...keys: any[]): PromiseLike<Refund[]>;
|
|
8
|
+
getAll(): PromiseLike<Refund[]>;
|
|
9
|
+
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Refund> | import("@antelopejs/interface-database-decorators").DeepPartial<Refund>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
10
|
+
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<Refund>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
11
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Refund>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
|
+
delete(id: string): Promise<number>;
|
|
13
|
+
};
|
|
14
|
+
readonly schemaName: string;
|
|
15
|
+
fromPlainData(obj: any): Refund;
|
|
16
|
+
fromDatabase(obj: any): Refund | undefined;
|
|
17
|
+
toDatabase(obj: any): Record<string, any>;
|
|
18
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
19
|
+
};
|
|
20
|
+
export declare class RefundModel extends RefundModel_base {
|
|
21
|
+
findOneByStripeRefund(stripeRefundId: string): Promise<Refund | undefined>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RefundModel = void 0;
|
|
4
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
5
|
+
const refunds_table_1 = require("../tables/refunds.table");
|
|
6
|
+
class RefundModel extends (0, interface_database_decorators_1.BasicDataModel)(refunds_table_1.Refund, refunds_table_1.refundsTableName) {
|
|
7
|
+
async findOneByStripeRefund(stripeRefundId) {
|
|
8
|
+
const row = await this.table
|
|
9
|
+
.getAll(stripeRefundId, "stripeRefundId")
|
|
10
|
+
.nth(0)
|
|
11
|
+
.default(undefined)
|
|
12
|
+
.run();
|
|
13
|
+
return row ? RefundModel.fromDatabase(row) : undefined;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.RefundModel = RefundModel;
|
|
17
|
+
//# sourceMappingURL=refunds.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refunds.model.js","sourceRoot":"","sources":["../../../src/db/models/refunds.model.ts"],"names":[],"mappings":";;;AAAA,6FAA2E;AAC3E,2DAAmE;AAGnE,MAAa,WAAY,SAAQ,IAAA,8CAAc,EAAC,sBAAM,EAAE,gCAAgB,CAAC;IACvE,KAAK,CAAC,qBAAqB,CACzB,cAAsB;QAEtB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK;aACzB,MAAM,CAAC,cAAc,EAAE,gBAAgB,CAAC;aACxC,GAAG,CAAC,CAAC,CAAC;aACN,OAAO,CAAC,SAAS,CAAC;aAClB,GAAG,EAAE,CAAC;QACT,OAAO,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACzD,CAAC;CACF;AAXD,kCAWC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function updatedRows(result: unknown): number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updatedRows = updatedRows;
|
|
4
|
+
function updatedRows(result) {
|
|
5
|
+
if (typeof result === "number")
|
|
6
|
+
return result;
|
|
7
|
+
const counts = result;
|
|
8
|
+
return Number(counts?.replaced ??
|
|
9
|
+
counts?.modifiedCount ??
|
|
10
|
+
counts?.deleted ??
|
|
11
|
+
counts?.deletedCount ??
|
|
12
|
+
0);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=revision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revision.js","sourceRoot":"","sources":["../../../src/db/models/revision.ts"],"names":[],"mappings":";;AAOA,kCAUC;AAVD,SAAgB,WAAW,CAAC,MAAe;IACzC,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC9C,MAAM,MAAM,GAAG,MAAkC,CAAC;IAClD,OAAO,MAAM,CACX,MAAM,EAAE,QAAQ;QACd,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,YAAY;QACpB,CAAC,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type DeepPartial, type ValidateOptions } from "@antelopejs/interface-database-decorators";
|
|
2
|
+
import { Segment } from "../tables/segments.table";
|
|
3
|
+
declare const SegmentModel_base: {
|
|
4
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
5
|
+
readonly table: import("@antelopejs/interface-database").Table<Segment>;
|
|
6
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
7
|
+
get(id: string): PromiseLike<Segment | undefined>;
|
|
8
|
+
getBy(index: keyof Segment, ...keys: any[]): PromiseLike<Segment[]>;
|
|
9
|
+
getAll(): PromiseLike<Segment[]>;
|
|
10
|
+
insert(obj: DeepPartial<Segment> | DeepPartial<Segment>[], options?: ValidateOptions): Promise<string[]>;
|
|
11
|
+
update(id: string, obj: DeepPartial<Segment>, options?: ValidateOptions): Promise<number>;
|
|
12
|
+
update(obj: DeepPartial<Segment>, options?: ValidateOptions): Promise<number>;
|
|
13
|
+
delete(id: string): Promise<number>;
|
|
14
|
+
};
|
|
15
|
+
readonly schemaName: string;
|
|
16
|
+
fromPlainData(obj: any): Segment;
|
|
17
|
+
fromDatabase(obj: any): Segment | undefined;
|
|
18
|
+
toDatabase(obj: any): Record<string, any>;
|
|
19
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
20
|
+
};
|
|
21
|
+
export declare class SegmentModel extends SegmentModel_base {
|
|
22
|
+
insert(rows: DeepPartial<Segment> | DeepPartial<Segment>[], options?: ValidateOptions): Promise<string[]>;
|
|
23
|
+
update(id: string, patch: DeepPartial<Segment>, options?: ValidateOptions): Promise<number>;
|
|
24
|
+
update(patch: DeepPartial<Segment>, options?: ValidateOptions): Promise<number>;
|
|
25
|
+
private updateRevision;
|
|
26
|
+
publishMemberships(segment: Segment, generation: string, count: number, evaluatedAt: Date): Promise<boolean>;
|
|
27
|
+
getMany(ids: readonly string[]): Promise<Segment[]>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SegmentModel = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
6
|
+
const segments_table_1 = require("../tables/segments.table");
|
|
7
|
+
class SegmentModel extends (0, interface_database_decorators_1.BasicDataModel)(segments_table_1.Segment, segments_table_1.segmentsTableName) {
|
|
8
|
+
insert(rows, options) {
|
|
9
|
+
const initialize = (row) => ({
|
|
10
|
+
...row,
|
|
11
|
+
revision: (0, node_crypto_1.randomUUID)(),
|
|
12
|
+
});
|
|
13
|
+
return super.insert(Array.isArray(rows) ? rows.map(initialize) : initialize(rows), options);
|
|
14
|
+
}
|
|
15
|
+
async update(idOrPatch, patchOrOptions, options) {
|
|
16
|
+
const id = typeof idOrPatch === "string" ? idOrPatch : idOrPatch._id;
|
|
17
|
+
if (!id)
|
|
18
|
+
throw new Error("Segment identity is required");
|
|
19
|
+
return this.updateRevision(id, typeof idOrPatch === "string"
|
|
20
|
+
? patchOrOptions
|
|
21
|
+
: idOrPatch, typeof idOrPatch === "string"
|
|
22
|
+
? options
|
|
23
|
+
: patchOrOptions);
|
|
24
|
+
}
|
|
25
|
+
async updateRevision(id, patch, options) {
|
|
26
|
+
if (options?.validate &&
|
|
27
|
+
!SegmentModel.validate(patch, { partial: true }).ok)
|
|
28
|
+
throw new Error("Invalid segment patch");
|
|
29
|
+
const current = await this.get(id);
|
|
30
|
+
if (!current)
|
|
31
|
+
return 0;
|
|
32
|
+
const { _id, revision, ...changes } = patch;
|
|
33
|
+
const instance = SegmentModel.fromPlainData(changes);
|
|
34
|
+
(0, interface_database_decorators_1.triggerEvent)(instance, "update");
|
|
35
|
+
const outcome = await this.table
|
|
36
|
+
.atomicMutation(id, {
|
|
37
|
+
type: "update",
|
|
38
|
+
revisionField: "revision",
|
|
39
|
+
expectedRevision: current.revision === undefined
|
|
40
|
+
? { kind: "missing" }
|
|
41
|
+
: current.revision,
|
|
42
|
+
nextRevision: (0, node_crypto_1.randomUUID)(),
|
|
43
|
+
patch: SegmentModel.toDatabase(instance),
|
|
44
|
+
})
|
|
45
|
+
.run();
|
|
46
|
+
if (outcome !== "applied")
|
|
47
|
+
throw new Error(`Segment edit ${outcome}; reload before retry`);
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
async publishMemberships(segment, generation, count, evaluatedAt) {
|
|
51
|
+
const outcome = await this.table
|
|
52
|
+
.atomicMutation(segment._id, {
|
|
53
|
+
type: "update",
|
|
54
|
+
revisionField: "revision",
|
|
55
|
+
expectedRevision: segment.revision === undefined
|
|
56
|
+
? { kind: "missing" }
|
|
57
|
+
: segment.revision,
|
|
58
|
+
nextRevision: (0, node_crypto_1.randomUUID)(),
|
|
59
|
+
patch: {
|
|
60
|
+
membershipGeneration: generation,
|
|
61
|
+
estimatedCount: count,
|
|
62
|
+
lastEvaluatedAt: evaluatedAt,
|
|
63
|
+
updatedAt: evaluatedAt,
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
.run();
|
|
67
|
+
if (outcome === "unknown")
|
|
68
|
+
throw new Error("Segment publication outcome is unknown");
|
|
69
|
+
return outcome === "applied";
|
|
70
|
+
}
|
|
71
|
+
async getMany(ids) {
|
|
72
|
+
if (ids.length === 0)
|
|
73
|
+
return [];
|
|
74
|
+
const rows = await this.table.getAll(ids).run();
|
|
75
|
+
return rows
|
|
76
|
+
.map((row) => SegmentModel.fromDatabase(row))
|
|
77
|
+
.filter((s) => s !== undefined);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.SegmentModel = SegmentModel;
|
|
81
|
+
//# sourceMappingURL=segments.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segments.model.js","sourceRoot":"","sources":["../../../src/db/models/segments.model.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,6FAKmD;AACnD,6DAAsE;AAGtE,MAAa,YAAa,SAAQ,IAAA,8CAAc,EAAC,wBAAO,EAAE,kCAAiB,CAAC;IAEjE,MAAM,CACb,IAAmD,EACnD,OAAyB;QAEzB,MAAM,UAAU,GAAG,CAAC,GAAyB,EAAwB,EAAE,CAAC,CAAC;YACvE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C,wCAAwC,CAAC,CAAC;QAC5D,OAAO,OAAO,KAAK,SAAS,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAsB;QAClC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAe,CAAC,CAAC,GAAG,EAAE,CAAC;QAC5D,OAAO,IAAI;aACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;aAC5C,MAAM,CAAC,CAAC,CAAC,EAAgB,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAClD,CAAC;CACF;AAhHD,oCAgHC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StripeWebhookEvent } from "../tables/stripeWebhookEvents.table";
|
|
2
|
+
export type WebhookCompletion = "success" | "skipped" | "reconciliation_required";
|
|
3
|
+
declare const StripeWebhookEventModel_base: {
|
|
4
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
5
|
+
readonly table: import("@antelopejs/interface-database").Table<StripeWebhookEvent>;
|
|
6
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
7
|
+
get(id: string): PromiseLike<StripeWebhookEvent | undefined>;
|
|
8
|
+
getBy(index: keyof StripeWebhookEvent, ...keys: any[]): PromiseLike<StripeWebhookEvent[]>;
|
|
9
|
+
getAll(): PromiseLike<StripeWebhookEvent[]>;
|
|
10
|
+
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<StripeWebhookEvent> | import("@antelopejs/interface-database-decorators").DeepPartial<StripeWebhookEvent>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
11
|
+
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<StripeWebhookEvent>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<StripeWebhookEvent>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
13
|
+
delete(id: string): Promise<number>;
|
|
14
|
+
};
|
|
15
|
+
readonly schemaName: string;
|
|
16
|
+
fromPlainData(obj: any): StripeWebhookEvent;
|
|
17
|
+
fromDatabase(obj: any): StripeWebhookEvent | undefined;
|
|
18
|
+
toDatabase(obj: any): Record<string, any>;
|
|
19
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
20
|
+
};
|
|
21
|
+
export declare class StripeWebhookEventModel extends StripeWebhookEventModel_base {
|
|
22
|
+
tryClaim(eventId: string, type: string): Promise<string | undefined>;
|
|
23
|
+
markResult(eventId: string, admittedRevision: string, result: WebhookCompletion, errorMessage: string | null): Promise<void>;
|
|
24
|
+
deleteProcessedBefore(cutoff: Date): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StripeWebhookEventModel = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
6
|
+
const stripeWebhookEvents_table_1 = require("../tables/stripeWebhookEvents.table");
|
|
7
|
+
const EPOCH_LOWER_BOUND = new Date(0);
|
|
8
|
+
const TERMINAL_RESULTS = new Set(["success", "skipped"]);
|
|
9
|
+
class StripeWebhookEventModel extends (0, interface_database_decorators_1.BasicDataModel)(stripeWebhookEvents_table_1.StripeWebhookEvent, stripeWebhookEvents_table_1.stripeWebhookEventsTableName) {
|
|
10
|
+
async tryClaim(eventId, type) {
|
|
11
|
+
const revision = (0, node_crypto_1.randomUUID)();
|
|
12
|
+
try {
|
|
13
|
+
await this.insert({
|
|
14
|
+
_id: eventId,
|
|
15
|
+
type,
|
|
16
|
+
processedAt: new Date(),
|
|
17
|
+
result: "pending",
|
|
18
|
+
errorMessage: null,
|
|
19
|
+
revision,
|
|
20
|
+
});
|
|
21
|
+
return revision;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const existing = await this.get(eventId);
|
|
25
|
+
if (!existing || existing.revision === revision)
|
|
26
|
+
throw error;
|
|
27
|
+
if (existing.type === type && TERMINAL_RESULTS.has(existing.result))
|
|
28
|
+
return undefined;
|
|
29
|
+
throw new Error("Webhook requires reconciliation; an existing attempt may have applied effects");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async markResult(eventId, admittedRevision, result, errorMessage) {
|
|
33
|
+
const outcome = await this.table
|
|
34
|
+
.atomicMutation(eventId, {
|
|
35
|
+
type: "update",
|
|
36
|
+
revisionField: "revision",
|
|
37
|
+
expectedRevision: admittedRevision,
|
|
38
|
+
nextRevision: (0, node_crypto_1.randomUUID)(),
|
|
39
|
+
patch: { result, errorMessage, processedAt: new Date() },
|
|
40
|
+
})
|
|
41
|
+
.run();
|
|
42
|
+
if (outcome !== "applied")
|
|
43
|
+
throw new Error(`Webhook completion ${outcome}; reconciliation required`);
|
|
44
|
+
}
|
|
45
|
+
async deleteProcessedBefore(cutoff) {
|
|
46
|
+
const candidates = await this.table
|
|
47
|
+
.between("processedAt", EPOCH_LOWER_BOUND, cutoff)
|
|
48
|
+
.run();
|
|
49
|
+
for (const candidate of candidates) {
|
|
50
|
+
const current = await this.get(candidate._id);
|
|
51
|
+
if (!current ||
|
|
52
|
+
!TERMINAL_RESULTS.has(current.result) ||
|
|
53
|
+
current.processedAt >= cutoff)
|
|
54
|
+
continue;
|
|
55
|
+
const outcome = await this.table
|
|
56
|
+
.atomicMutation(current._id, {
|
|
57
|
+
type: "delete",
|
|
58
|
+
revisionField: "revision",
|
|
59
|
+
expectedRevision: current.revision === undefined
|
|
60
|
+
? { kind: "missing" }
|
|
61
|
+
: current.revision,
|
|
62
|
+
})
|
|
63
|
+
.run();
|
|
64
|
+
if (outcome === "unknown")
|
|
65
|
+
throw new Error("Webhook cleanup outcome is unknown");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.StripeWebhookEventModel = StripeWebhookEventModel;
|
|
70
|
+
//# sourceMappingURL=stripeWebhookEvents.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripeWebhookEvents.model.js","sourceRoot":"","sources":["../../../src/db/models/stripeWebhookEvents.model.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,6FAA2E;AAC3E,mFAG6C;AAE7C,MAAM,iBAAiB,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;AACtC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAQzD,MAAa,uBAAwB,SAAQ,IAAA,8CAAc,EACzD,8CAAkB,EAClB,wDAA4B,CAC7B;IAEC,KAAK,CAAC,QAAQ,CAAC,OAAe,EAAE,IAAY;QAC1C,MAAM,QAAQ,GAAG,IAAA,wBAAU,GAAE,CAAC;QAC9B,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC;gBAChB,GAAG,EAAE,OAAO;gBACZ,IAAI;gBACJ,WAAW,EAAE,IAAI,IAAI,EAAE;gBACvB,MAAM,EAAE,SAAS;gBACjB,YAAY,EAAE,IAAI;gBAClB,QAAQ;aACT,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACzC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ;gBAAE,MAAM,KAAK,CAAC;YAC7D,IAAI,QAAQ,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