@antelopejs/interface-dms-saas 0.7.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/db/models/features.model.d.ts +1 -1
- package/dist/db/models/plans.model.d.ts +1 -1
- package/dist/db/tables/creditNotes.table.d.ts +1 -26
- package/dist/db/tables/creditNotes.table.js +5 -107
- package/dist/db/tables/creditNotes.table.js.map +1 -1
- package/dist/db/tables/features.table.d.ts +10 -2
- package/dist/db/tables/features.table.js +7 -1
- package/dist/db/tables/features.table.js.map +1 -1
- package/dist/db/tables/internal/credit-notes-refunds.table.d.ts +40 -0
- package/dist/db/tables/internal/credit-notes-refunds.table.js +164 -0
- package/dist/db/tables/internal/credit-notes-refunds.table.js.map +1 -0
- package/dist/db/tables/plans.table.d.ts +10 -3
- package/dist/db/tables/plans.table.js.map +1 -1
- package/dist/db/tables/refunds.table.d.ts +1 -15
- package/dist/db/tables/refunds.table.js +4 -66
- package/dist/db/tables/refunds.table.js.map +1 -1
- package/dist/invoice-line-items.js +7 -7
- package/dist/invoice-line-items.js.map +1 -1
- package/dist/plans.d.ts +1 -1
- package/dist/plans.js +3 -7
- package/dist/plans.js.map +1 -1
- package/docs/4.pages-plans-data.md +22 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ export const isProvisioningCommitted = tenantLifecycle.IsTenantProvisioningCommi
|
|
|
40
40
|
|
|
41
41
|
The [entry-point reference](./docs/1.index.md#entry-points) lists the supported subpaths. Importing `/db` registers the SaaS tables, so it is not a types-only import. After direct subscription writes, call [`RecomputeTenantBillingState`](./docs/2.billing.md#recomputetenantbillingstate) to refresh the derived billing state and the workspace directory row.
|
|
42
42
|
|
|
43
|
-
A module may seed plans straight into the `db` plan table. It writes `name`, `description` and `borderLabel` with one value per locale
|
|
43
|
+
A module may seed plans straight into the `db` plan table. It writes `name`, `description` and `borderLabel` with one value per locale on the `PlanInAllLocales` view that `localize("*", PLAN_LOCALIZED_FIELDS)` returns. It leaves `Plan.paymentProviderRefs` empty and never rewrites it, because `@antelopejs/dms-saas` links every billed plan to Stripe itself. See [Plans and their Stripe products](https://dms.antelopejs.com/docs/modules/saas/stripe#plans-and-their-stripe-products).
|
|
44
44
|
|
|
45
45
|
## Compatibility
|
|
46
46
|
|
|
@@ -53,7 +53,7 @@ A module may seed plans straight into the `db` plan table. It writes `name`, `de
|
|
|
53
53
|
| `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` | `0.4.0` |
|
|
54
54
|
| `@antelopejs/interface-data-api` | `>=0.6.1 <1.0.0` | `0.6.1` |
|
|
55
55
|
| `@antelopejs/interface-database` | `>=0.1.11 <1.0.0` | `0.3.0` |
|
|
56
|
-
| `@antelopejs/interface-database-decorators` | `>=0.
|
|
56
|
+
| `@antelopejs/interface-database-decorators` | `>=0.2.2 <1.0.0` | `0.3.2` |
|
|
57
57
|
| `@antelopejs/interface-dms` | `>=0.12.0 <1.0.0` | `0.12.0` |
|
|
58
58
|
|
|
59
59
|
<!-- antelopejs-docs-compat:end -->
|
|
@@ -4,7 +4,7 @@ declare const FeatureModel_base: {
|
|
|
4
4
|
readonly table: import("@antelopejs/interface-database").Table<Feature>;
|
|
5
5
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
6
6
|
get(id: string): PromiseLike<Feature | undefined>;
|
|
7
|
-
getBy(index: "_id" | "description" | "valueType" | "defaultValue" | "createdAt" | "updatedAt" | "order" | "displayName" | "tooltip" | "unit" | "isDetailRow"
|
|
7
|
+
getBy(index: "_id" | "localize" | "description" | "valueType" | "defaultValue" | "createdAt" | "updatedAt" | "order" | "displayName" | "tooltip" | "unit" | "isDetailRow", ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<Feature[]>;
|
|
8
8
|
getAll(): PromiseLike<Feature[]>;
|
|
9
9
|
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Feature> | import("@antelopejs/interface-database-decorators").DeepPartial<Feature>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
10
10
|
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<Feature>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
@@ -9,7 +9,7 @@ declare const PlanModel_base: {
|
|
|
9
9
|
readonly table: import("@antelopejs/interface-database").Table<Plan>;
|
|
10
10
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
11
11
|
get(id: string): PromiseLike<Plan | undefined>;
|
|
12
|
-
getBy(index: "_id" | "description" | "createdAt" | "updatedAt" | "name" | "permissions" | "currency" | "features" | "order" | "slug" | "audience" | "price" | "interval" | "billingMode" | "inheritsFromPlanId" | "trialDays" | "maxMembers" | "isPublic" | "paymentProviderRefs" | "borderColor" | "borderLabel" | "isActive" | "isDeleted"
|
|
12
|
+
getBy(index: "_id" | "localize" | "description" | "createdAt" | "updatedAt" | "name" | "permissions" | "currency" | "features" | "order" | "slug" | "audience" | "price" | "interval" | "billingMode" | "inheritsFromPlanId" | "trialDays" | "maxMembers" | "isPublic" | "paymentProviderRefs" | "borderColor" | "borderLabel" | "isActive" | "isDeleted", ...keys: IndexKey[]): PromiseLike<Plan[]>;
|
|
13
13
|
getAll(): PromiseLike<Plan[]>;
|
|
14
14
|
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[]>;
|
|
15
15
|
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<Plan>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const creditNotesTableName = "credit_notes";
|
|
3
|
-
export declare const CREDIT_NOTE_TYPES: readonly ["pre_payment", "post_payment", "credit_to_balance", "refund", "mixed"];
|
|
4
|
-
export type CreditNoteType = (typeof CREDIT_NOTE_TYPES)[number];
|
|
5
|
-
export declare const CREDIT_NOTE_STATUSES: readonly ["issued", "void"];
|
|
6
|
-
export type CreditNoteStatus = (typeof CREDIT_NOTE_STATUSES)[number];
|
|
7
|
-
export declare class CreditNote extends Table {
|
|
8
|
-
_id: string;
|
|
9
|
-
invoiceId: string;
|
|
10
|
-
stripeCreditNoteId: string;
|
|
11
|
-
number: string;
|
|
12
|
-
amount: number;
|
|
13
|
-
currency: string;
|
|
14
|
-
reason: string;
|
|
15
|
-
memo: string | null;
|
|
16
|
-
type: CreditNoteType;
|
|
17
|
-
refundId: string | null;
|
|
18
|
-
hostedUrl: string | null;
|
|
19
|
-
pdfUrl: string | null;
|
|
20
|
-
status: CreditNoteStatus;
|
|
21
|
-
issuedAt: Date;
|
|
22
|
-
voidedAt: Date | null;
|
|
23
|
-
metadata: Record<string, string>;
|
|
24
|
-
createdAt: Date;
|
|
25
|
-
updatedAt: Date;
|
|
26
|
-
}
|
|
1
|
+
export { creditNotesTableName, CREDIT_NOTE_TYPES, type CreditNoteType, CREDIT_NOTE_STATUSES, type CreditNoteStatus, CreditNote, } from "./internal/credit-notes-refunds.table";
|
|
@@ -1,111 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.CreditNote = exports.CREDIT_NOTE_STATUSES = exports.CREDIT_NOTE_TYPES = exports.creditNotesTableName = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
exports
|
|
18
|
-
exports.CREDIT_NOTE_TYPES = [
|
|
19
|
-
"pre_payment",
|
|
20
|
-
"post_payment",
|
|
21
|
-
"credit_to_balance",
|
|
22
|
-
"refund",
|
|
23
|
-
"mixed",
|
|
24
|
-
];
|
|
25
|
-
exports.CREDIT_NOTE_STATUSES = ["issued", "void"];
|
|
26
|
-
let CreditNote = class CreditNote extends interface_database_decorators_1.Table {
|
|
27
|
-
};
|
|
28
|
-
exports.CreditNote = CreditNote;
|
|
29
|
-
__decorate([
|
|
30
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], CreditNote.prototype, "_id", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, interface_database_decorators_1.Index)(),
|
|
35
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
36
|
-
(0, interface_database_decorators_1.Relation)({ to: () => invoices_table_1.Invoice }),
|
|
37
|
-
__metadata("design:type", String)
|
|
38
|
-
], CreditNote.prototype, "invoiceId", void 0);
|
|
39
|
-
__decorate([
|
|
40
|
-
(0, interface_database_decorators_1.Index)(),
|
|
41
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
42
|
-
__metadata("design:type", String)
|
|
43
|
-
], CreditNote.prototype, "stripeCreditNoteId", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
46
|
-
__metadata("design:type", String)
|
|
47
|
-
], CreditNote.prototype, "number", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, interface_database_decorators_1.Field)("number"),
|
|
50
|
-
__metadata("design:type", Number)
|
|
51
|
-
], CreditNote.prototype, "amount", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
54
|
-
__metadata("design:type", String)
|
|
55
|
-
], CreditNote.prototype, "currency", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
58
|
-
__metadata("design:type", String)
|
|
59
|
-
], CreditNote.prototype, "reason", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
62
|
-
__metadata("design:type", Object)
|
|
63
|
-
], CreditNote.prototype, "memo", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
66
|
-
__metadata("design:type", String)
|
|
67
|
-
], CreditNote.prototype, "type", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
70
|
-
(0, interface_database_decorators_1.Relation)({ to: () => refunds_table_1.Refund }),
|
|
71
|
-
__metadata("design:type", Object)
|
|
72
|
-
], CreditNote.prototype, "refundId", void 0);
|
|
73
|
-
__decorate([
|
|
74
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
75
|
-
__metadata("design:type", Object)
|
|
76
|
-
], CreditNote.prototype, "hostedUrl", void 0);
|
|
77
|
-
__decorate([
|
|
78
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
79
|
-
__metadata("design:type", Object)
|
|
80
|
-
], CreditNote.prototype, "pdfUrl", void 0);
|
|
81
|
-
__decorate([
|
|
82
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
83
|
-
__metadata("design:type", String)
|
|
84
|
-
], CreditNote.prototype, "status", void 0);
|
|
85
|
-
__decorate([
|
|
86
|
-
(0, interface_database_decorators_1.Index)({ crossInstance: true }),
|
|
87
|
-
(0, interface_database_decorators_1.Field)("date"),
|
|
88
|
-
__metadata("design:type", Date)
|
|
89
|
-
], CreditNote.prototype, "issuedAt", void 0);
|
|
90
|
-
__decorate([
|
|
91
|
-
(0, interface_database_decorators_1.Field)("date"),
|
|
92
|
-
__metadata("design:type", Object)
|
|
93
|
-
], CreditNote.prototype, "voidedAt", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
(0, interface_database_decorators_1.Field)("any"),
|
|
96
|
-
__metadata("design:type", Object)
|
|
97
|
-
], CreditNote.prototype, "metadata", void 0);
|
|
98
|
-
__decorate([
|
|
99
|
-
(0, interface_database_decorators_1.CreationTime)(),
|
|
100
|
-
(0, interface_database_decorators_1.Field)("date"),
|
|
101
|
-
__metadata("design:type", Date)
|
|
102
|
-
], CreditNote.prototype, "createdAt", void 0);
|
|
103
|
-
__decorate([
|
|
104
|
-
(0, interface_database_decorators_1.UpdateTime)(),
|
|
105
|
-
(0, interface_database_decorators_1.Field)("date"),
|
|
106
|
-
__metadata("design:type", Date)
|
|
107
|
-
], CreditNote.prototype, "updatedAt", void 0);
|
|
108
|
-
exports.CreditNote = CreditNote = __decorate([
|
|
109
|
-
(0, interface_database_decorators_1.RegisterTable)(exports.creditNotesTableName, constants_1.TENANT_SCHEMA_NAME)
|
|
110
|
-
], CreditNote);
|
|
4
|
+
var credit_notes_refunds_table_1 = require("./internal/credit-notes-refunds.table");
|
|
5
|
+
Object.defineProperty(exports, "creditNotesTableName", { enumerable: true, get: function () { return credit_notes_refunds_table_1.creditNotesTableName; } });
|
|
6
|
+
Object.defineProperty(exports, "CREDIT_NOTE_TYPES", { enumerable: true, get: function () { return credit_notes_refunds_table_1.CREDIT_NOTE_TYPES; } });
|
|
7
|
+
Object.defineProperty(exports, "CREDIT_NOTE_STATUSES", { enumerable: true, get: function () { return credit_notes_refunds_table_1.CREDIT_NOTE_STATUSES; } });
|
|
8
|
+
Object.defineProperty(exports, "CreditNote", { enumerable: true, get: function () { return credit_notes_refunds_table_1.CreditNote; } });
|
|
111
9
|
//# sourceMappingURL=creditNotes.table.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creditNotes.table.js","sourceRoot":"","sources":["../../../src/db/tables/creditNotes.table.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"creditNotes.table.js","sourceRoot":"","sources":["../../../src/db/tables/creditNotes.table.ts"],"names":[],"mappings":";;;AAAA,oFAO+C;AAN7C,kIAAA,oBAAoB,OAAA;AACpB,+HAAA,iBAAiB,OAAA;AAEjB,kIAAA,oBAAoB,OAAA;AAEpB,wHAAA,UAAU,OAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Table } from "@antelopejs/interface-database-decorators";
|
|
1
|
+
import { type LocalizedRecords, Table } from "@antelopejs/interface-database-decorators";
|
|
2
2
|
export declare const featuresTableName = "features";
|
|
3
3
|
export declare const FEATURE_VALUE_TYPES: readonly ["boolean", "number", "string"];
|
|
4
4
|
export type FeatureValueType = (typeof FEATURE_VALUE_TYPES)[number];
|
|
@@ -7,10 +7,18 @@ export type FeatureValues = Record<string, FeatureValue>;
|
|
|
7
7
|
export declare const FEATURE_DEFAULT_ORDER = 0;
|
|
8
8
|
export declare const FEATURE_FALLBACK_LOCALE = "en";
|
|
9
9
|
export type FeatureLocalizedText = Record<string, string>;
|
|
10
|
+
export declare const FEATURE_LOCALIZED_FIELDS: readonly ["displayName", "description", "tooltip", "unit"];
|
|
11
|
+
export type FeatureLocalizedField = (typeof FEATURE_LOCALIZED_FIELDS)[number];
|
|
12
|
+
export type FeatureInAllLocales = Omit<LocalizedRecords<Feature, FeatureLocalizedField>, FeatureLocalizedField> & {
|
|
13
|
+
[P in FeatureLocalizedField]: Record<string, Exclude<Feature[P], undefined>> | Feature[P] | undefined;
|
|
14
|
+
};
|
|
10
15
|
declare const Feature_base: import("@antelopejs/interface-database-decorators").TableClass<Table & {
|
|
11
16
|
localize<This extends {
|
|
12
17
|
constructor: any;
|
|
13
|
-
}>(this: This, locale:
|
|
18
|
+
}, K extends keyof This>(this: This, locale: "*", fields: readonly K[]): LocalizedRecords<This, K>;
|
|
19
|
+
localize<This extends {
|
|
20
|
+
constructor: any;
|
|
21
|
+
}>(this: This, locale: string, fields?: ReadonlyArray<keyof This>): This;
|
|
14
22
|
}, [], object>;
|
|
15
23
|
export declare class Feature extends Feature_base {
|
|
16
24
|
_id: string;
|
|
@@ -9,13 +9,19 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Feature = exports.FEATURE_FALLBACK_LOCALE = exports.FEATURE_DEFAULT_ORDER = exports.FEATURE_VALUE_TYPES = exports.featuresTableName = void 0;
|
|
12
|
+
exports.Feature = exports.FEATURE_LOCALIZED_FIELDS = exports.FEATURE_FALLBACK_LOCALE = exports.FEATURE_DEFAULT_ORDER = exports.FEATURE_VALUE_TYPES = exports.featuresTableName = void 0;
|
|
13
13
|
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
14
14
|
const constants_1 = require("@antelopejs/interface-dms/constants");
|
|
15
15
|
exports.featuresTableName = "features";
|
|
16
16
|
exports.FEATURE_VALUE_TYPES = ["boolean", "number", "string"];
|
|
17
17
|
exports.FEATURE_DEFAULT_ORDER = 0;
|
|
18
18
|
exports.FEATURE_FALLBACK_LOCALE = "en";
|
|
19
|
+
exports.FEATURE_LOCALIZED_FIELDS = [
|
|
20
|
+
"displayName",
|
|
21
|
+
"description",
|
|
22
|
+
"tooltip",
|
|
23
|
+
"unit",
|
|
24
|
+
];
|
|
19
25
|
let Feature = class Feature extends interface_database_decorators_1.Table.with(interface_database_decorators_1.LocalizationModifier) {
|
|
20
26
|
};
|
|
21
27
|
exports.Feature = Feature;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.table.js","sourceRoot":"","sources":["../../../src/db/tables/features.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|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;;sCACM;AAId;IAFP,IAAA,4CAAY,GAAE;IACd,IAAA,qCAAK,EAAC,MAAM,CAAC;8BACK,IAAI;0CAAC;AAIhB;IAFP,IAAA,0CAAU,GAAE;IACZ,IAAA,qCAAK,EAAC,MAAM,CAAC;8BACK,IAAI;0CAAC;kBAtCb,OAAO;IADnB,IAAA,6CAAa,EAAC,yBAAiB,EAAE,4BAAgB,CAAC;GACtC,OAAO,CAuCnB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Table } from "@antelopejs/interface-database-decorators";
|
|
2
|
+
export declare const refundsTableName = "refunds";
|
|
3
|
+
export declare const REFUND_STATUSES: readonly ["pending", "succeeded", "failed", "canceled"];
|
|
4
|
+
export type RefundStatus = (typeof REFUND_STATUSES)[number];
|
|
5
|
+
export declare class Refund extends Table {
|
|
6
|
+
_id: string;
|
|
7
|
+
creditNoteId: string;
|
|
8
|
+
stripeRefundId: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
currency: string;
|
|
11
|
+
status: RefundStatus;
|
|
12
|
+
failureReason: string | null;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
}
|
|
16
|
+
export declare const creditNotesTableName = "credit_notes";
|
|
17
|
+
export declare const CREDIT_NOTE_TYPES: readonly ["pre_payment", "post_payment", "credit_to_balance", "refund", "mixed"];
|
|
18
|
+
export type CreditNoteType = (typeof CREDIT_NOTE_TYPES)[number];
|
|
19
|
+
export declare const CREDIT_NOTE_STATUSES: readonly ["issued", "void"];
|
|
20
|
+
export type CreditNoteStatus = (typeof CREDIT_NOTE_STATUSES)[number];
|
|
21
|
+
export declare class CreditNote extends Table {
|
|
22
|
+
_id: string;
|
|
23
|
+
invoiceId: string;
|
|
24
|
+
stripeCreditNoteId: string;
|
|
25
|
+
number: string;
|
|
26
|
+
amount: number;
|
|
27
|
+
currency: string;
|
|
28
|
+
reason: string;
|
|
29
|
+
memo: string | null;
|
|
30
|
+
type: CreditNoteType;
|
|
31
|
+
refundId: string | null;
|
|
32
|
+
hostedUrl: string | null;
|
|
33
|
+
pdfUrl: string | null;
|
|
34
|
+
status: CreditNoteStatus;
|
|
35
|
+
issuedAt: Date;
|
|
36
|
+
voidedAt: Date | null;
|
|
37
|
+
metadata: Record<string, string>;
|
|
38
|
+
createdAt: Date;
|
|
39
|
+
updatedAt: Date;
|
|
40
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CreditNote = exports.CREDIT_NOTE_STATUSES = exports.CREDIT_NOTE_TYPES = exports.creditNotesTableName = exports.Refund = exports.REFUND_STATUSES = exports.refundsTableName = void 0;
|
|
13
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
14
|
+
const constants_1 = require("@antelopejs/interface-dms/constants");
|
|
15
|
+
const invoices_table_1 = require("../invoices.table");
|
|
16
|
+
exports.refundsTableName = "refunds";
|
|
17
|
+
exports.REFUND_STATUSES = [
|
|
18
|
+
"pending",
|
|
19
|
+
"succeeded",
|
|
20
|
+
"failed",
|
|
21
|
+
"canceled",
|
|
22
|
+
];
|
|
23
|
+
let Refund = class Refund extends interface_database_decorators_1.Table {
|
|
24
|
+
};
|
|
25
|
+
exports.Refund = Refund;
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], Refund.prototype, "_id", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, interface_database_decorators_1.Index)(),
|
|
32
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
33
|
+
(0, interface_database_decorators_1.Relation)({ to: () => CreditNote }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Refund.prototype, "creditNoteId", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, interface_database_decorators_1.Index)(),
|
|
38
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], Refund.prototype, "stripeRefundId", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, interface_database_decorators_1.Field)("number"),
|
|
43
|
+
__metadata("design:type", Number)
|
|
44
|
+
], Refund.prototype, "amount", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], Refund.prototype, "currency", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], Refund.prototype, "status", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], Refund.prototype, "failureReason", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, interface_database_decorators_1.CreationTime)(),
|
|
59
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
60
|
+
__metadata("design:type", Date)
|
|
61
|
+
], Refund.prototype, "createdAt", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, interface_database_decorators_1.UpdateTime)(),
|
|
64
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
65
|
+
__metadata("design:type", Date)
|
|
66
|
+
], Refund.prototype, "updatedAt", void 0);
|
|
67
|
+
exports.Refund = Refund = __decorate([
|
|
68
|
+
(0, interface_database_decorators_1.RegisterTable)(exports.refundsTableName, constants_1.TENANT_SCHEMA_NAME)
|
|
69
|
+
], Refund);
|
|
70
|
+
exports.creditNotesTableName = "credit_notes";
|
|
71
|
+
exports.CREDIT_NOTE_TYPES = [
|
|
72
|
+
"pre_payment",
|
|
73
|
+
"post_payment",
|
|
74
|
+
"credit_to_balance",
|
|
75
|
+
"refund",
|
|
76
|
+
"mixed",
|
|
77
|
+
];
|
|
78
|
+
exports.CREDIT_NOTE_STATUSES = ["issued", "void"];
|
|
79
|
+
let CreditNote = class CreditNote extends interface_database_decorators_1.Table {
|
|
80
|
+
};
|
|
81
|
+
exports.CreditNote = CreditNote;
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], CreditNote.prototype, "_id", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, interface_database_decorators_1.Index)(),
|
|
88
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
89
|
+
(0, interface_database_decorators_1.Relation)({ to: () => invoices_table_1.Invoice }),
|
|
90
|
+
__metadata("design:type", String)
|
|
91
|
+
], CreditNote.prototype, "invoiceId", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, interface_database_decorators_1.Index)(),
|
|
94
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
95
|
+
__metadata("design:type", String)
|
|
96
|
+
], CreditNote.prototype, "stripeCreditNoteId", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
99
|
+
__metadata("design:type", String)
|
|
100
|
+
], CreditNote.prototype, "number", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, interface_database_decorators_1.Field)("number"),
|
|
103
|
+
__metadata("design:type", Number)
|
|
104
|
+
], CreditNote.prototype, "amount", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
107
|
+
__metadata("design:type", String)
|
|
108
|
+
], CreditNote.prototype, "currency", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
111
|
+
__metadata("design:type", String)
|
|
112
|
+
], CreditNote.prototype, "reason", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
115
|
+
__metadata("design:type", Object)
|
|
116
|
+
], CreditNote.prototype, "memo", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
119
|
+
__metadata("design:type", String)
|
|
120
|
+
], CreditNote.prototype, "type", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
123
|
+
(0, interface_database_decorators_1.Relation)({ to: () => Refund }),
|
|
124
|
+
__metadata("design:type", Object)
|
|
125
|
+
], CreditNote.prototype, "refundId", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
128
|
+
__metadata("design:type", Object)
|
|
129
|
+
], CreditNote.prototype, "hostedUrl", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
132
|
+
__metadata("design:type", Object)
|
|
133
|
+
], CreditNote.prototype, "pdfUrl", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
136
|
+
__metadata("design:type", String)
|
|
137
|
+
], CreditNote.prototype, "status", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, interface_database_decorators_1.Index)({ crossInstance: true }),
|
|
140
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
141
|
+
__metadata("design:type", Date)
|
|
142
|
+
], CreditNote.prototype, "issuedAt", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
145
|
+
__metadata("design:type", Object)
|
|
146
|
+
], CreditNote.prototype, "voidedAt", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
(0, interface_database_decorators_1.Field)("any"),
|
|
149
|
+
__metadata("design:type", Object)
|
|
150
|
+
], CreditNote.prototype, "metadata", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
(0, interface_database_decorators_1.CreationTime)(),
|
|
153
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
154
|
+
__metadata("design:type", Date)
|
|
155
|
+
], CreditNote.prototype, "createdAt", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
(0, interface_database_decorators_1.UpdateTime)(),
|
|
158
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
159
|
+
__metadata("design:type", Date)
|
|
160
|
+
], CreditNote.prototype, "updatedAt", void 0);
|
|
161
|
+
exports.CreditNote = CreditNote = __decorate([
|
|
162
|
+
(0, interface_database_decorators_1.RegisterTable)(exports.creditNotesTableName, constants_1.TENANT_SCHEMA_NAME)
|
|
163
|
+
], CreditNote);
|
|
164
|
+
//# sourceMappingURL=credit-notes-refunds.table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credit-notes-refunds.table.js","sourceRoot":"","sources":["../../../../src/db/tables/internal/credit-notes-refunds.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA,6FAQmD;AACnD,mEAAyE;AACzE,sDAA4C;AAE/B,QAAA,gBAAgB,GAAG,SAAS,CAAC;AAE7B,QAAA,eAAe,GAAG;IAC7B,SAAS;IACT,WAAW;IACX,QAAQ;IACR,UAAU;CACF,CAAC;AAKJ,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,qCAAK;CAgChC,CAAA;AAhCY,wBAAM;AAET;IAD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elopejs/interface-database-decorators";
|
|
1
|
+
import { type LocalizedRecords, Table } from "@antelopejs/interface-database-decorators";
|
|
2
2
|
import type { FeatureValue } from "./features.table";
|
|
3
3
|
export declare const plansTableName = "plans";
|
|
4
4
|
export declare const PLAN_FALLBACK_LOCALE = "en";
|
|
@@ -33,12 +33,19 @@ export interface PlanProviderRefs {
|
|
|
33
33
|
stripePriceId?: string;
|
|
34
34
|
stripeSyncedTerms?: PlanStripeSyncedTerms;
|
|
35
35
|
}
|
|
36
|
-
export declare const PLAN_LOCALIZED_FIELDS:
|
|
36
|
+
export declare const PLAN_LOCALIZED_FIELDS: readonly ["name", "description", "borderLabel"];
|
|
37
|
+
export type PlanLocalizedField = (typeof PLAN_LOCALIZED_FIELDS)[number];
|
|
38
|
+
export type PlanInAllLocales = Omit<LocalizedRecords<Plan, PlanLocalizedField>, PlanLocalizedField> & {
|
|
39
|
+
[P in PlanLocalizedField]: Record<string, Exclude<Plan[P], undefined>> | Plan[P] | undefined;
|
|
40
|
+
};
|
|
37
41
|
export declare const PLAN_UNLIMITED = -1;
|
|
38
42
|
declare const Plan_base: import("@antelopejs/interface-database-decorators").TableClass<Table & {
|
|
39
43
|
localize<This extends {
|
|
40
44
|
constructor: any;
|
|
41
|
-
}>(this: This, locale:
|
|
45
|
+
}, K extends keyof This>(this: This, locale: "*", fields: readonly K[]): LocalizedRecords<This, K>;
|
|
46
|
+
localize<This extends {
|
|
47
|
+
constructor: any;
|
|
48
|
+
}>(this: This, locale: string, fields?: ReadonlyArray<keyof This>): This;
|
|
42
49
|
}, [], object>;
|
|
43
50
|
export declare class Plan extends Plan_base {
|
|
44
51
|
_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plans.table.js","sourceRoot":"","sources":["../../../src/db/tables/plans.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"plans.table.js","sourceRoot":"","sources":["../../../src/db/tables/plans.table.ts"],"names":[],"mappings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,CAAC;;sCACwB;AAG7B;IADP,IAAA,qCAAK,EAAC,CAAC,QAAQ,CAAC,CAAC;;yCACY;AAItB;IAFP,IAAA,qCAAK,EAAC,QAAQ,CAAC;IACf,IAAA,wCAAQ,EAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;;gDACa;AAGlC;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;uCACU;AAIlB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;wCACW;AAInB;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,SAAS,CAAC;;sCACS;AAGlB;IADP,IAAA,qCAAK,EAAC,KAAK,CAAC;;iDACiC;AAGtC;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;yCACmB;AAI3B;IAFP,IAAA,yCAAS,EAAC,EAAE,cAAc,EAAE,4BAAoB,EAAE,CAAC;IACnD,IAAA,qCAAK,EAAC,QAAQ,CAAC;;yCACmB;AAI3B;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;mCACM;AAId;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,SAAS,CAAC;;sCACS;AAGlB;IADP,IAAA,qCAAK,EAAC,SAAS,CAAC;;uCACU;AAInB;IAFP,IAAA,4CAAY,GAAE;IACd,IAAA,qCAAK,EAAC,MAAM,CAAC;8BACK,IAAI;uCAAC;AAIhB;IAFP,IAAA,0CAAU,GAAE;IACZ,IAAA,qCAAK,EAAC,MAAM,CAAC;8BACK,IAAI;uCAAC;eAhFb,IAAI;IADhB,IAAA,6CAAa,EAAC,sBAAc,EAAE,4BAAgB,CAAC;GACnC,IAAI,CAiFhB"}
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const refundsTableName = "refunds";
|
|
3
|
-
export declare const REFUND_STATUSES: readonly ["pending", "succeeded", "failed", "canceled"];
|
|
4
|
-
export type RefundStatus = (typeof REFUND_STATUSES)[number];
|
|
5
|
-
export declare class Refund extends Table {
|
|
6
|
-
_id: string;
|
|
7
|
-
creditNoteId: string;
|
|
8
|
-
stripeRefundId: string;
|
|
9
|
-
amount: number;
|
|
10
|
-
currency: string;
|
|
11
|
-
status: RefundStatus;
|
|
12
|
-
failureReason: string | null;
|
|
13
|
-
createdAt: Date;
|
|
14
|
-
updatedAt: Date;
|
|
15
|
-
}
|
|
1
|
+
export { refundsTableName, REFUND_STATUSES, type RefundStatus, Refund, } from "./internal/credit-notes-refunds.table";
|
|
@@ -1,70 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.Refund = exports.REFUND_STATUSES = exports.refundsTableName = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports
|
|
17
|
-
exports.REFUND_STATUSES = [
|
|
18
|
-
"pending",
|
|
19
|
-
"succeeded",
|
|
20
|
-
"failed",
|
|
21
|
-
"canceled",
|
|
22
|
-
];
|
|
23
|
-
let Refund = class Refund extends interface_database_decorators_1.Table {
|
|
24
|
-
};
|
|
25
|
-
exports.Refund = Refund;
|
|
26
|
-
__decorate([
|
|
27
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
28
|
-
__metadata("design:type", String)
|
|
29
|
-
], Refund.prototype, "_id", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
(0, interface_database_decorators_1.Index)(),
|
|
32
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
33
|
-
(0, interface_database_decorators_1.Relation)({ to: () => creditNotes_table_1.CreditNote }),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], Refund.prototype, "creditNoteId", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, interface_database_decorators_1.Index)(),
|
|
38
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
39
|
-
__metadata("design:type", String)
|
|
40
|
-
], Refund.prototype, "stripeRefundId", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
(0, interface_database_decorators_1.Field)("number"),
|
|
43
|
-
__metadata("design:type", Number)
|
|
44
|
-
], Refund.prototype, "amount", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
47
|
-
__metadata("design:type", String)
|
|
48
|
-
], Refund.prototype, "currency", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
51
|
-
__metadata("design:type", String)
|
|
52
|
-
], Refund.prototype, "status", void 0);
|
|
53
|
-
__decorate([
|
|
54
|
-
(0, interface_database_decorators_1.Field)("string"),
|
|
55
|
-
__metadata("design:type", Object)
|
|
56
|
-
], Refund.prototype, "failureReason", void 0);
|
|
57
|
-
__decorate([
|
|
58
|
-
(0, interface_database_decorators_1.CreationTime)(),
|
|
59
|
-
(0, interface_database_decorators_1.Field)("date"),
|
|
60
|
-
__metadata("design:type", Date)
|
|
61
|
-
], Refund.prototype, "createdAt", void 0);
|
|
62
|
-
__decorate([
|
|
63
|
-
(0, interface_database_decorators_1.UpdateTime)(),
|
|
64
|
-
(0, interface_database_decorators_1.Field)("date"),
|
|
65
|
-
__metadata("design:type", Date)
|
|
66
|
-
], Refund.prototype, "updatedAt", void 0);
|
|
67
|
-
exports.Refund = Refund = __decorate([
|
|
68
|
-
(0, interface_database_decorators_1.RegisterTable)(exports.refundsTableName, constants_1.TENANT_SCHEMA_NAME)
|
|
69
|
-
], Refund);
|
|
4
|
+
var credit_notes_refunds_table_1 = require("./internal/credit-notes-refunds.table");
|
|
5
|
+
Object.defineProperty(exports, "refundsTableName", { enumerable: true, get: function () { return credit_notes_refunds_table_1.refundsTableName; } });
|
|
6
|
+
Object.defineProperty(exports, "REFUND_STATUSES", { enumerable: true, get: function () { return credit_notes_refunds_table_1.REFUND_STATUSES; } });
|
|
7
|
+
Object.defineProperty(exports, "Refund", { enumerable: true, get: function () { return credit_notes_refunds_table_1.Refund; } });
|
|
70
8
|
//# sourceMappingURL=refunds.table.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refunds.table.js","sourceRoot":"","sources":["../../../src/db/tables/refunds.table.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"refunds.table.js","sourceRoot":"","sources":["../../../src/db/tables/refunds.table.ts"],"names":[],"mappings":";;;AAAA,oFAK+C;AAJ7C,8HAAA,gBAAgB,OAAA;AAChB,6HAAA,eAAe,OAAA;AAEf,oHAAA,MAAM,OAAA"}
|
|
@@ -22,18 +22,18 @@ const MAX_LINE_KEY_LENGTH = 150;
|
|
|
22
22
|
function isText(value) {
|
|
23
23
|
return typeof value === "string";
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return isText(
|
|
25
|
+
function hasFilledText(item, field) {
|
|
26
|
+
return isText(item[field]) && item[field].trim().length > 0;
|
|
27
27
|
}
|
|
28
28
|
const REJECTION_RULES = [
|
|
29
|
-
{ reason: "invalid", isViolated: (item) => !
|
|
29
|
+
{ reason: "invalid", isViolated: (item) => !hasFilledText(item, "key") },
|
|
30
30
|
{
|
|
31
31
|
reason: "invalid",
|
|
32
32
|
isViolated: (item) => item.key.includes(exports.LINE_KEY_SEPARATOR),
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
reason: "invalid",
|
|
36
|
-
isViolated: (item) => !
|
|
36
|
+
isViolated: (item) => !hasFilledText(item, "description"),
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
reason: "invalid",
|
|
@@ -44,8 +44,8 @@ const REJECTION_RULES = [
|
|
|
44
44
|
function buildInvoiceLineKey(providerId, key) {
|
|
45
45
|
return `${providerId}${exports.LINE_KEY_SEPARATOR}${key}`;
|
|
46
46
|
}
|
|
47
|
-
function toLineKeyFragment(
|
|
48
|
-
return isText(key) ? key.trim() : String(key);
|
|
47
|
+
function toLineKeyFragment(item) {
|
|
48
|
+
return isText(item.key) ? item.key.trim() : String(item.key);
|
|
49
49
|
}
|
|
50
50
|
function findRejectionReason(item) {
|
|
51
51
|
return REJECTION_RULES.find((rule) => rule.isViolated(item))?.reason ?? null;
|
|
@@ -65,7 +65,7 @@ function selectInvoiceLineItemsToCreate(providerId, items, alreadyInjectedKeys)
|
|
|
65
65
|
const skipped = [];
|
|
66
66
|
const selectedKeys = new Set();
|
|
67
67
|
for (const item of items) {
|
|
68
|
-
const lineKey = buildInvoiceLineKey(providerId, toLineKeyFragment(item
|
|
68
|
+
const lineKey = buildInvoiceLineKey(providerId, toLineKeyFragment(item));
|
|
69
69
|
const rejection = findRejectionReason(item) ?? findOversizedKeyRejection(lineKey);
|
|
70
70
|
if (rejection) {
|
|
71
71
|
skipped.push({ lineKey, reason: rejection });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoice-line-items.js","sourceRoot":"","sources":["../src/invoice-line-items.ts"],"names":[],"mappings":";;;AA0FA,kFASC;
|
|
1
|
+
{"version":3,"file":"invoice-line-items.js","sourceRoot":"","sources":["../src/invoice-line-items.ts"],"names":[],"mappings":";;;AA0FA,kFASC;AAuFD,kDAEC;AAoCD,wEA+BC;AAyCD,4EASC;AAKD,gFAEC;AAxTD,+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;AACN,CAAC,EAJgB,QAAQ,wBAAR,QAAQ,QAIxB;AAmCD,SAAgB,gCAAgC,CAC9C,QAAkC;IAElC,IAAI,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,0BAAkB,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CACb,qDAAqD,0BAAkB,WAAW,QAAQ,CAAC,EAAE,KAAK,CACnG,CAAC;IACJ,CAAC;IACD,QAAQ,CAAC,gCAAgC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC5E,CAAC;AAKD,SAAgB,kCAAkC,CAAC,UAAkB;IACnE,QAAQ,CAAC,gCAAgC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AACnE,CAAC"}
|
package/dist/plans.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Feature, FeatureModel, FeatureValues, FeatureValueType, Plan, PlanInterval, PlanModel } from "./db";
|
|
2
|
+
export { FEATURE_LOCALIZED_FIELDS } from "./db";
|
|
2
3
|
export interface TenantPlanFeature {
|
|
3
4
|
featureId: string;
|
|
4
5
|
displayName: string;
|
|
@@ -24,7 +25,6 @@ export interface TenantPlanCatalog {
|
|
|
24
25
|
}
|
|
25
26
|
export declare function monthlyPrice(plan: Plan): number;
|
|
26
27
|
export declare function isDowngrade(current: Plan | null, target: Plan, seats?: number): boolean;
|
|
27
|
-
export declare const FEATURE_LOCALIZED_FIELDS: Array<keyof Feature>;
|
|
28
28
|
export declare function localizeFeature(feature: Feature, locale: string): Feature;
|
|
29
29
|
export declare function localizePlan(plan: Plan, locale: string): Plan;
|
|
30
30
|
export declare function buildTenantPlanCatalog(planModel: PlanModel, featureModel: FeatureModel, plans: Plan[], locale: string): Promise<TenantPlanCatalog>;
|
package/dist/plans.js
CHANGED
|
@@ -7,6 +7,8 @@ exports.localizeFeature = localizeFeature;
|
|
|
7
7
|
exports.localizePlan = localizePlan;
|
|
8
8
|
exports.buildTenantPlanCatalog = buildTenantPlanCatalog;
|
|
9
9
|
const db_1 = require("./db");
|
|
10
|
+
var db_2 = require("./db");
|
|
11
|
+
Object.defineProperty(exports, "FEATURE_LOCALIZED_FIELDS", { enumerable: true, get: function () { return db_2.FEATURE_LOCALIZED_FIELDS; } });
|
|
10
12
|
const MONTHS_PER_INTERVAL = {
|
|
11
13
|
month: 1,
|
|
12
14
|
year: 12,
|
|
@@ -27,14 +29,8 @@ function isDowngrade(current, target, seats = MIN_BILLED_SEATS) {
|
|
|
27
29
|
return false;
|
|
28
30
|
return monthlyCost(target, seats) < monthlyCost(current, seats);
|
|
29
31
|
}
|
|
30
|
-
exports.FEATURE_LOCALIZED_FIELDS = [
|
|
31
|
-
"displayName",
|
|
32
|
-
"description",
|
|
33
|
-
"tooltip",
|
|
34
|
-
"unit",
|
|
35
|
-
];
|
|
36
32
|
function localizeFeature(feature, locale) {
|
|
37
|
-
return feature.localize(locale,
|
|
33
|
+
return feature.localize(locale, db_1.FEATURE_LOCALIZED_FIELDS);
|
|
38
34
|
}
|
|
39
35
|
function localizePlan(plan, locale) {
|
|
40
36
|
return plan.localize(locale, db_1.PLAN_LOCALIZED_FIELDS);
|
package/dist/plans.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plans.js","sourceRoot":"","sources":["../src/plans.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"plans.js","sourceRoot":"","sources":["../src/plans.ts"],"names":[],"mappings":";;;AAoDA,oCAEC;AAsBD,kCAOC;AASD,0CAEC;AAUD,oCAEC;AAgDD,wDAiBC;AAlKD,6BAIc;AAEd,2BAAgD;AAAvC,8GAAA,wBAAwB,OAAA;AAEjC,MAAM,mBAAmB,GAAiC;IACxD,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,EAAE;CACT,CAAC;AAgCF,SAAgB,YAAY,CAAC,IAAU;IACrC,OAAO,IAAI,CAAC,KAAK,GAAG,mBAAmB,CAAC,IAAI,CA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C;IACF,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC5D,QAAQ,EAAE,QAAQ;aACf,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;aACjE,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;KACnD,CAAC;AACJ,CAAC"}
|
|
@@ -53,6 +53,28 @@ These helpers are exported from `/plans`. They do not charge customers or author
|
|
|
53
53
|
|
|
54
54
|
The catalogue builder does not filter an arbitrary plan list down to what a user may buy, so the caller authorizes the plans and models it passes. Localized plan and feature texts are written through the canonical model's `localize("*")` convention, with one value per locale (`{ en: "Pro", fr: "Pro" }`), never as `$` i18n keys. The [feature integration guide](/docs/modules/saas/extending#plan-feature-labels-and-values) shows the convention.
|
|
55
55
|
|
|
56
|
+
`localize("*", FEATURE_LOCALIZED_FIELDS)` returns a `FeatureInAllLocales`, and `localize("*", PLAN_LOCALIZED_FIELDS)` a `PlanInAllLocales` (both from `/db`). In that view a module assigns per-locale wording to each localized field directly. Read from the database, a field holds that record, the plain text of a row written before the field was localized, or nothing when the text was never set, so a reader narrows it first. `localize(locale)` on the view gives back the row type that `insert` and `update` take, with every locale still stored:
|
|
57
|
+
|
|
58
|
+
```ts docs-check
|
|
59
|
+
import { GetModel } from "@antelopejs/interface-database-decorators";
|
|
60
|
+
import {
|
|
61
|
+
FEATURE_FALLBACK_LOCALE,
|
|
62
|
+
FEATURE_LOCALIZED_FIELDS,
|
|
63
|
+
type FeatureInAllLocales,
|
|
64
|
+
FeatureModel,
|
|
65
|
+
} from "@antelopejs/interface-dms-saas/db";
|
|
66
|
+
|
|
67
|
+
export async function renameMembersFeature(id: string): Promise<void> {
|
|
68
|
+
const model = GetModel(FeatureModel);
|
|
69
|
+
const row = await model.get(id);
|
|
70
|
+
if (!row) return;
|
|
71
|
+
const texts: FeatureInAllLocales = row.localize("*", FEATURE_LOCALIZED_FIELDS);
|
|
72
|
+
texts.displayName = { en: "Members", fr: "Membres" };
|
|
73
|
+
texts.tooltip = { en: "People in the workspace" };
|
|
74
|
+
await model.update(id, texts.localize(FEATURE_FALLBACK_LOCALE));
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
56
78
|
## `HiddenStringFilter`
|
|
57
79
|
|
|
58
80
|
`HiddenStringFilter(): PropertyDecorator` is exported from `/data-api`, `/hidden-filter` and the root. It registers string comparisons, including the `is` mode that `TableView.routeParamFilters` uses, without a visible `@Column`. It decorates a field of the data controller prototype, such as `_instance` or `userId`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/interface-dms-saas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "AntelopeJS interface for the DMS SaaS module: billing, plans, registration, workspace pages and lifecycle extension points.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@antelopejs/interface-api": ">=0.3.0 <1.0.0",
|
|
75
|
-
"@antelopejs/interface-api-util": ">=0.3.
|
|
75
|
+
"@antelopejs/interface-api-util": ">=0.3.2 <1.0.0",
|
|
76
76
|
"@antelopejs/interface-core": ">=0.4.0 <1.0.0",
|
|
77
77
|
"@antelopejs/interface-database": ">=0.3.0 <1.0.0",
|
|
78
|
-
"@antelopejs/interface-database-decorators": ">=0.2
|
|
78
|
+
"@antelopejs/interface-database-decorators": ">=0.3.2 <1.0.0",
|
|
79
79
|
"@types/node": "^24.0.0",
|
|
80
80
|
"knip": "^6.34.0",
|
|
81
81
|
"release-it": "^19.2.4",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@antelopejs/interface-core": ">=0.2.4 <1.0.0",
|
|
88
88
|
"@antelopejs/interface-database": ">=0.1.11 <1.0.0",
|
|
89
|
-
"@antelopejs/interface-database-decorators": ">=0.
|
|
89
|
+
"@antelopejs/interface-database-decorators": ">=0.2.2 <1.0.0"
|
|
90
90
|
},
|
|
91
91
|
"packageManager": "pnpm@10.2.0",
|
|
92
92
|
"antelopeJs": {}
|