@antelopejs/interface-dms-saas 0.7.1 → 0.8.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/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/plans.table.d.ts +10 -3
- package/dist/db/tables/plans.table.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.1` |
|
|
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,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,
|
|
1
|
+
{"version":3,"file":"features.table.js","sourceRoot":"","sources":["../../../src/db/tables/features.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6FASmD;AACnD,mEAAuE;AAE1D,QAAA,iBAAiB,GAAG,UAAU,CAAC;AAE/B,QAAA,mBAAmB,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAY/D,QAAA,qBAAqB,GAAG,CAAC,CAAC;AAG1B,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAM/B,QAAA,wBAAwB,GAAG;IACtC,aAAa;IACb,aAAa;IACb,SAAS;IACT,MAAM;CACyC,CAAC;AA+B3C,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,qCAAK,CAAC,IAAI,CAAC,oDAAoB,CAAC;CAuC5D,CAAA;AAvCY,0BAAO;AAEV;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;oCACI;AAIZ;IAFP,IAAA,yCAAS,EAAC,EAAE,cAAc,EAAE,+BAAuB,EAAE,CAAC;IACtD,IAAA,qCAAK,EAAC,QAAQ,CAAC;;4CACY;AAIpB;IAFP,IAAA,yCAAS,EAAC,EAAE,cAAc,EAAE,+BAAuB,EAAE,CAAC;IACtD,IAAA,qCAAK,EAAC,QAAQ,CAAC;;4CACY;AAGpB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;0CACoB;AAG5B;IADP,IAAA,qCAAK,EAAC,KAAK,CAAC;;6CACsB;AAI3B;IAFP,IAAA,yCAAS,EAAC,EAAE,cAAc,EAAE,+BAAuB,EAAE,CAAC;IACtD,IAAA,qCAAK,EAAC,QAAQ,CAAC;;wCACe;AAIvB;IAFP,IAAA,yCAAS,EAAC,EAAE,cAAc,EAAE,+BAAuB,EAAE,CAAC;IACtD,IAAA,qCAAK,EAAC,QAAQ,CAAC;;qCACY;AAGpB;IADP,IAAA,qCAAK,EAAC,SAAS,CAAC;;4CACY;AAGrB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Table } from "@antelopejs/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":";;;;;;;;;;;;AAAA,6FAWmD;AACnD,mEAAuE;AAG1D,QAAA,cAAc,GAAG,OAAO,CAAC;AAGzB,QAAA,oBAAoB,GAAG,IAAI,CAAC;AAK5B,QAAA,cAAc,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,CAAU,CAAC;AAG5D,QAAA,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,CAAU,CAAC;AAG5C,QAAA,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC;AA4C/C,QAAA,qBAAqB,GAAG;IACnC,MAAM;IACN,aAAa;IACb,aAAa;CAC+B,CAAC;AAwBlC,QAAA,cAAc,GAAG,CAAC,CAAC,CAAC;AAW1B,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,qCAAK,CAAC,IAAI,CAAC,oDAAoB,CAAC;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,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"}
|
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,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CAAC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC,CAC1E,CAAC;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.8.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.
|
|
78
|
+
"@antelopejs/interface-database-decorators": ">=0.3.1 <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": {}
|