@antelopejs/interface-dms-saas 0.6.1 → 0.7.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/README.md +27 -34
- package/dist/db/models/billingSettings.model.d.ts +7 -5
- package/dist/db/models/creditNotes.model.d.ts +7 -5
- package/dist/db/models/features.model.d.ts +7 -5
- package/dist/db/models/invoices.model.d.ts +7 -5
- package/dist/db/models/legalDocuments.model.d.ts +7 -5
- package/dist/db/models/patch-validation.d.ts +3 -0
- package/dist/db/models/patch-validation.js +40 -0
- package/dist/db/models/patch-validation.js.map +1 -0
- package/dist/db/models/planMigrations.model.d.ts +7 -5
- package/dist/db/models/plans.model.d.ts +9 -6
- package/dist/db/models/plans.model.js.map +1 -1
- package/dist/db/models/platformNotes.model.d.ts +7 -5
- package/dist/db/models/refunds.model.d.ts +7 -5
- package/dist/db/models/segments.model.d.ts +7 -5
- package/dist/db/models/segments.model.js +12 -9
- package/dist/db/models/segments.model.js.map +1 -1
- package/dist/db/models/stripeWebhookEvents.model.d.ts +7 -5
- package/dist/db/models/tenantBillingInfo.model.d.ts +7 -5
- package/dist/db/models/tenantBillingState.model.d.ts +7 -5
- package/dist/db/models/tenantSubscriptions.model.d.ts +7 -5
- package/dist/db/models/tenantSubscriptions.model.js +16 -9
- package/dist/db/models/tenantSubscriptions.model.js.map +1 -1
- package/dist/db/models/trialConsumptions.model.d.ts +7 -5
- package/dist/db/models/update-result.d.ts +8 -1
- package/dist/db/models/update-result.js +8 -2
- package/dist/db/models/update-result.js.map +1 -1
- package/dist/db/models/userSegments.model.d.ts +7 -5
- package/dist/db/tables/creditNotes.table.d.ts +1 -1
- package/dist/db/tables/creditNotes.table.js.map +1 -1
- package/dist/db/tables/features.table.d.ts +3 -1
- package/dist/db/tables/features.table.js.map +1 -1
- package/dist/db/tables/invoices.table.d.ts +1 -1
- package/dist/db/tables/planMigrations.table.d.ts +3 -2
- package/dist/db/tables/planMigrations.table.js.map +1 -1
- package/dist/db/tables/plans.table.d.ts +2 -1
- package/dist/db/tables/plans.table.js.map +1 -1
- package/dist/db/tables/refunds.table.js.map +1 -1
- package/dist/db/tables/segments.table.js +5 -7
- package/dist/db/tables/segments.table.js.map +1 -1
- package/dist/db/tables/tenantSubscriptions.table.js +4 -3
- package/dist/db/tables/tenantSubscriptions.table.js.map +1 -1
- package/dist/hidden-filter.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/invoice-line-items.d.ts +1 -1
- package/dist/invoice-line-items.js +9 -7
- package/dist/invoice-line-items.js.map +1 -1
- package/dist/json.d.ts +6 -0
- package/dist/json.js +3 -0
- package/dist/json.js.map +1 -0
- package/dist/pages.d.ts +5 -0
- package/dist/pages.js.map +1 -1
- package/dist/plans.d.ts +2 -2
- package/dist/plans.js.map +1 -1
- package/dist/provisioning.d.ts +2 -1
- package/docs/1.index.md +13 -13
- package/docs/2.billing.md +30 -34
- package/docs/3.lifecycle-and-usage.md +44 -37
- package/docs/4.pages-plans-data.md +24 -23
- package/docs/tsconfig.json +9 -1
- package/package.json +9 -13
- package/dist/db/models/revision.d.ts +0 -1
- package/dist/db/models/revision.js +0 -14
- package/dist/db/models/revision.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# `@antelopejs/interface-dms-saas`
|
|
4
4
|
|
|
5
|
-
<a href="https://www.npmjs.com/package/@antelopejs/interface-dms-saas"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/interface-dms-saas?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
6
|
-
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/interface-dms-saas?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
7
|
-
<a href="https://discord.gg/
|
|
8
|
-
<a href="https://dms.antelopejs.com/docs/modules/saas/extending"><img alt="Documentation" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/@antelopejs/interface-dms-saas"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/interface-dms-saas?style=for-the-badge&labelColor=000000&color=000000" data-illustration></a>
|
|
6
|
+
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/interface-dms-saas?style=for-the-badge&labelColor=000000&color=000000" data-illustration></a>
|
|
7
|
+
<a href="https://discord.gg/g4pFt6eXqu"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000" data-illustration></a>
|
|
8
|
+
<a href="https://dms.antelopejs.com/docs/modules/saas/extending"><img alt="Documentation" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000" data-illustration></a>
|
|
9
9
|
|
|
10
|
-
The AntelopeJS interface
|
|
10
|
+
The AntelopeJS interface that extends the DMS SaaS module with billing, plans, registration, workspace pages and lifecycle.
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -16,8 +16,8 @@ The AntelopeJS interface to extend the DMS SaaS module: billing, plans, registra
|
|
|
16
16
|
- Adds invoice line items, reads customer balances and previews the upcoming invoice.
|
|
17
17
|
- Builds plan projections and catalogues, and normalizes prices.
|
|
18
18
|
- Extends registration and the provisioning of a new workspace.
|
|
19
|
-
- Adds
|
|
20
|
-
- Listens to tenant lifecycle events
|
|
19
|
+
- Adds blocks to the tenant billing page and the platform workspace detail page.
|
|
20
|
+
- Listens to tenant lifecycle events, guards paid-to-Free plan changes, and exposes the canonical SaaS tables and models (`/db`).
|
|
21
21
|
|
|
22
22
|
A module that extends [`@antelopejs/dms-saas`](https://www.npmjs.com/package/@antelopejs/dms-saas) depends on this package, never on the runtime.
|
|
23
23
|
|
|
@@ -29,7 +29,7 @@ pnpm add @antelopejs/interface-dms-saas
|
|
|
29
29
|
|
|
30
30
|
## Quick start
|
|
31
31
|
|
|
32
|
-
The root entry holds every extension point except `db
|
|
32
|
+
The root entry holds every extension point except `db`. `invoiceLineItems`, `tenantLifecycle` and `planChanges` are namespaces at the root:
|
|
33
33
|
|
|
34
34
|
```ts docs-check
|
|
35
35
|
import { invoiceLineItems, tenantLifecycle } from "@antelopejs/interface-dms-saas";
|
|
@@ -38,43 +38,36 @@ export const usageKey = invoiceLineItems.buildInvoiceLineKey("example.compute",
|
|
|
38
38
|
export const isProvisioningCommitted = tenantLifecycle.IsTenantProvisioningCommitted;
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
subpaths. Importing `/db` registers SaaS tables; it is not a side-effect-free
|
|
43
|
-
types barrel. After direct subscription writes, call
|
|
44
|
-
[`RecomputeTenantBillingState`](./docs/2.billing.md#recomputetenantbillingstate)
|
|
45
|
-
to refresh derived billing and workspace directory state.
|
|
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.
|
|
46
42
|
|
|
47
|
-
A module may seed plans straight into the `db` plan table
|
|
43
|
+
A module may seed plans straight into the `db` plan table. It writes `name`, `description` and `borderLabel` with one value per locale through `localize("*")`. 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).
|
|
48
44
|
|
|
49
45
|
## Compatibility
|
|
50
46
|
|
|
51
|
-
|
|
47
|
+
`@antelopejs/dms-saas` implements this interface. The compatibility block of its [README](../dms-saas/README.md#compatibility) lists the interface range each module release supports. The interface declares these dependencies:
|
|
52
48
|
|
|
53
|
-
<!-- docs-compat:
|
|
49
|
+
<!-- antelopejs-docs-compat:start -->
|
|
54
50
|
|
|
55
|
-
| Package |
|
|
56
|
-
|
|
|
57
|
-
| `@antelopejs/interface-
|
|
58
|
-
| `@antelopejs/interface-
|
|
51
|
+
| Package | Supported | Tested with |
|
|
52
|
+
| ------------------------------------------- | ----------------- | ----------- |
|
|
53
|
+
| `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` | `0.4.0` |
|
|
54
|
+
| `@antelopejs/interface-data-api` | `>=0.6.1 <1.0.0` | `0.6.1` |
|
|
55
|
+
| `@antelopejs/interface-database` | `>=0.1.11 <1.0.0` | `0.3.0` |
|
|
56
|
+
| `@antelopejs/interface-database-decorators` | `>=0.1.10 <1.0.0` | `0.2.0` |
|
|
57
|
+
| `@antelopejs/interface-dms` | `>=0.12.0 <1.0.0` | `0.12.0` |
|
|
59
58
|
|
|
60
|
-
|
|
59
|
+
<!-- antelopejs-docs-compat:end -->
|
|
61
60
|
|
|
62
|
-
|
|
61
|
+
`@antelopejs/interface-core`, `@antelopejs/interface-database` and `@antelopejs/interface-database-decorators` are peer dependencies. `@antelopejs/interface-data-api` and `@antelopejs/interface-dms` are regular dependencies.
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
| --- | --- |
|
|
66
|
-
| `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` |
|
|
67
|
-
| `@antelopejs/interface-database` | `>=0.1.11 <1.0.0` |
|
|
68
|
-
| `@antelopejs/interface-database-decorators` | `>=0.1.10 <1.0.0` |
|
|
69
|
-
|
|
70
|
-
Subpaths resolve through the `exports` map only: compile consumers with `moduleResolution` set to `bundler`, `node16` or `nodenext`. Upgrade this package together with `@antelopejs/dms-saas`; the [upgrade notes](https://dms.antelopejs.com/docs/modules/saas/faq#upgrading) cover the tenant billing page anchors and the rows written by earlier builds.
|
|
63
|
+
Subpaths resolve through the `exports` map only, so compile consumers with `moduleResolution` set to `bundler`, `node16` or `nodenext`. Upgrade this package together with `@antelopejs/dms-saas`. The [upgrade notes](https://dms.antelopejs.com/docs/modules/saas/faq#upgrading) cover the tenant billing page anchors and the rows written by earlier builds.
|
|
71
64
|
|
|
72
65
|
## Documentation
|
|
73
66
|
|
|
74
|
-
- [
|
|
75
|
-
- [Extending the SaaS module](https://dms.antelopejs.com/docs/modules/saas/extending)
|
|
76
|
-
- [Stripe](https://dms.antelopejs.com/docs/modules/saas/stripe)
|
|
77
|
-
- [SaaS module guide](https://dms.antelopejs.com/docs/modules/saas)
|
|
67
|
+
- The [consumer reference](./docs/1.index.md) covers billing, usage, lifecycle, pages, plans and the database boundary.
|
|
68
|
+
- [Extending the SaaS module](https://dms.antelopejs.com/docs/modules/saas/extending) shows every extension point with examples.
|
|
69
|
+
- [Stripe](https://dms.antelopejs.com/docs/modules/saas/stripe) explains how the module drives Stripe.
|
|
70
|
+
- The [SaaS module guide](https://dms.antelopejs.com/docs/modules/saas) covers installation and configuration.
|
|
78
71
|
|
|
79
72
|
## Contributing
|
|
80
73
|
|
|
@@ -4,18 +4,20 @@ declare const BillingSettingsModel_base: {
|
|
|
4
4
|
readonly table: import("@antelopejs/interface-database").Table<BillingSettings>;
|
|
5
5
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
6
6
|
get(id: string): PromiseLike<BillingSettings | undefined>;
|
|
7
|
-
getBy(index: keyof BillingSettings, ...keys:
|
|
7
|
+
getBy(index: keyof BillingSettings, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<BillingSettings[]>;
|
|
8
8
|
getAll(): PromiseLike<BillingSettings[]>;
|
|
9
9
|
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<BillingSettings> | import("@antelopejs/interface-database-decorators").DeepPartial<BillingSettings>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
10
10
|
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<BillingSettings>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
11
|
-
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<BillingSettings
|
|
11
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<BillingSettings> & {
|
|
12
|
+
_id: string;
|
|
13
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
14
|
delete(id: string): Promise<number>;
|
|
13
15
|
};
|
|
14
|
-
readonly schemaName: string;
|
|
16
|
+
readonly schemaName: string | undefined;
|
|
15
17
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<BillingSettings>;
|
|
16
|
-
fromPlainData(obj:
|
|
18
|
+
fromPlainData(obj: BillingSettings | import("@antelopejs/interface-database-decorators").PlainData<BillingSettings>): BillingSettings;
|
|
17
19
|
fromDatabase(obj: any): BillingSettings | undefined;
|
|
18
|
-
toDatabase(obj:
|
|
20
|
+
toDatabase(obj: BillingSettings | import("@antelopejs/interface-database-decorators").PlainData<BillingSettings>): import("@antelopejs/interface-database-decorators").StoredRow<BillingSettings>;
|
|
19
21
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
20
22
|
};
|
|
21
23
|
export declare class BillingSettingsModel extends BillingSettingsModel_base {
|
|
@@ -5,18 +5,20 @@ declare const CreditNoteModel_base: {
|
|
|
5
5
|
readonly table: import("@antelopejs/interface-database").Table<CreditNote>;
|
|
6
6
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
7
7
|
get(id: string): PromiseLike<CreditNote | undefined>;
|
|
8
|
-
getBy(index: keyof CreditNote, ...keys:
|
|
8
|
+
getBy(index: keyof CreditNote, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<CreditNote[]>;
|
|
9
9
|
getAll(): PromiseLike<CreditNote[]>;
|
|
10
10
|
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<CreditNote> | import("@antelopejs/interface-database-decorators").DeepPartial<CreditNote>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
11
11
|
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<CreditNote>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
|
-
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<CreditNote
|
|
12
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<CreditNote> & {
|
|
13
|
+
_id: string;
|
|
14
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
13
15
|
delete(id: string): Promise<number>;
|
|
14
16
|
};
|
|
15
|
-
readonly schemaName: string;
|
|
17
|
+
readonly schemaName: string | undefined;
|
|
16
18
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<CreditNote>;
|
|
17
|
-
fromPlainData(obj:
|
|
19
|
+
fromPlainData(obj: CreditNote | import("@antelopejs/interface-database-decorators").PlainData<CreditNote>): CreditNote;
|
|
18
20
|
fromDatabase(obj: any): CreditNote | undefined;
|
|
19
|
-
toDatabase(obj:
|
|
21
|
+
toDatabase(obj: CreditNote | import("@antelopejs/interface-database-decorators").PlainData<CreditNote>): import("@antelopejs/interface-database-decorators").StoredRow<CreditNote>;
|
|
20
22
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
21
23
|
};
|
|
22
24
|
export declare class CreditNoteModel extends CreditNoteModel_base {
|
|
@@ -4,18 +4,20 @@ 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:
|
|
7
|
+
getBy(index: "_id" | "description" | "valueType" | "defaultValue" | "createdAt" | "updatedAt" | "order" | "displayName" | "tooltip" | "unit" | "isDetailRow" | "localize", ...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>;
|
|
11
|
-
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Feature
|
|
11
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Feature> & {
|
|
12
|
+
_id: string;
|
|
13
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
14
|
delete(id: string): Promise<number>;
|
|
13
15
|
};
|
|
14
|
-
readonly schemaName: string;
|
|
16
|
+
readonly schemaName: string | undefined;
|
|
15
17
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<Feature>;
|
|
16
|
-
fromPlainData(obj:
|
|
18
|
+
fromPlainData(obj: Feature | import("@antelopejs/interface-database-decorators").PlainData<Feature>): Feature;
|
|
17
19
|
fromDatabase(obj: any): Feature | undefined;
|
|
18
|
-
toDatabase(obj:
|
|
20
|
+
toDatabase(obj: Feature | import("@antelopejs/interface-database-decorators").PlainData<Feature>): import("@antelopejs/interface-database-decorators").StoredRow<Feature>;
|
|
19
21
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
20
22
|
};
|
|
21
23
|
export declare class FeatureModel extends FeatureModel_base {
|
|
@@ -5,18 +5,20 @@ declare const InvoiceModel_base: {
|
|
|
5
5
|
readonly table: import("@antelopejs/interface-database").Table<Invoice>;
|
|
6
6
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
7
7
|
get(id: string): PromiseLike<Invoice | undefined>;
|
|
8
|
-
getBy(index: keyof Invoice, ...keys:
|
|
8
|
+
getBy(index: keyof Invoice, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<Invoice[]>;
|
|
9
9
|
getAll(): PromiseLike<Invoice[]>;
|
|
10
10
|
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Invoice> | import("@antelopejs/interface-database-decorators").DeepPartial<Invoice>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
11
11
|
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<Invoice>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
|
-
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Invoice
|
|
12
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Invoice> & {
|
|
13
|
+
_id: string;
|
|
14
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
13
15
|
delete(id: string): Promise<number>;
|
|
14
16
|
};
|
|
15
|
-
readonly schemaName: string;
|
|
17
|
+
readonly schemaName: string | undefined;
|
|
16
18
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<Invoice>;
|
|
17
|
-
fromPlainData(obj:
|
|
19
|
+
fromPlainData(obj: Invoice | import("@antelopejs/interface-database-decorators").PlainData<Invoice>): Invoice;
|
|
18
20
|
fromDatabase(obj: any): Invoice | undefined;
|
|
19
|
-
toDatabase(obj:
|
|
21
|
+
toDatabase(obj: Invoice | import("@antelopejs/interface-database-decorators").PlainData<Invoice>): import("@antelopejs/interface-database-decorators").StoredRow<Invoice>;
|
|
20
22
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
21
23
|
};
|
|
22
24
|
export declare class InvoiceModel extends InvoiceModel_base {
|
|
@@ -4,18 +4,20 @@ declare const LegalDocumentsModel_base: {
|
|
|
4
4
|
readonly table: import("@antelopejs/interface-database").Table<LegalDocuments>;
|
|
5
5
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
6
6
|
get(id: string): PromiseLike<LegalDocuments | undefined>;
|
|
7
|
-
getBy(index: keyof LegalDocuments, ...keys:
|
|
7
|
+
getBy(index: keyof LegalDocuments, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<LegalDocuments[]>;
|
|
8
8
|
getAll(): PromiseLike<LegalDocuments[]>;
|
|
9
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
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
|
|
11
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<LegalDocuments> & {
|
|
12
|
+
_id: string;
|
|
13
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
14
|
delete(id: string): Promise<number>;
|
|
13
15
|
};
|
|
14
|
-
readonly schemaName: string;
|
|
16
|
+
readonly schemaName: string | undefined;
|
|
15
17
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<LegalDocuments>;
|
|
16
|
-
fromPlainData(obj:
|
|
18
|
+
fromPlainData(obj: LegalDocuments | import("@antelopejs/interface-database-decorators").PlainData<LegalDocuments>): LegalDocuments;
|
|
17
19
|
fromDatabase(obj: any): LegalDocuments | undefined;
|
|
18
|
-
toDatabase(obj:
|
|
20
|
+
toDatabase(obj: LegalDocuments | import("@antelopejs/interface-database-decorators").PlainData<LegalDocuments>): import("@antelopejs/interface-database-decorators").StoredRow<LegalDocuments>;
|
|
19
21
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
20
22
|
};
|
|
21
23
|
export declare class LegalDocumentsModel extends LegalDocumentsModel_base {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type Constructible, type DeepPartial } from "@antelopejs/interface-database-decorators";
|
|
2
|
+
export type FieldGuard = (value: unknown) => value is unknown;
|
|
3
|
+
export declare function matchesDeclaredTypes<T extends object>(table: Constructible<T>, patch: DeepPartial<T>, refinements?: Readonly<Record<string, FieldGuard>>): boolean;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.matchesDeclaredTypes = matchesDeclaredTypes;
|
|
4
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
5
|
+
const UNCHECKED_TYPE_NAME = "any";
|
|
6
|
+
function isString(value) {
|
|
7
|
+
return typeof value === "string";
|
|
8
|
+
}
|
|
9
|
+
function isNumber(value) {
|
|
10
|
+
return typeof value === "number" && !Number.isNaN(value);
|
|
11
|
+
}
|
|
12
|
+
function isBoolean(value) {
|
|
13
|
+
return typeof value === "boolean";
|
|
14
|
+
}
|
|
15
|
+
function isDate(value) {
|
|
16
|
+
return value instanceof Date && !Number.isNaN(value.getTime());
|
|
17
|
+
}
|
|
18
|
+
const TYPE_NAME_GUARDS = new Map([
|
|
19
|
+
["string", isString],
|
|
20
|
+
["number", isNumber],
|
|
21
|
+
["boolean", isBoolean],
|
|
22
|
+
["date", isDate],
|
|
23
|
+
]);
|
|
24
|
+
function isTypeName(type) {
|
|
25
|
+
return typeof type === "string";
|
|
26
|
+
}
|
|
27
|
+
function matchesDeclaredTypes(table, patch, refinements = {}) {
|
|
28
|
+
const { fields } = (0, interface_database_decorators_1.getMetadata)(table, interface_database_decorators_1.DatumStaticMetadata);
|
|
29
|
+
return Object.entries(patch).every(([field, value]) => {
|
|
30
|
+
if (value === undefined)
|
|
31
|
+
return true;
|
|
32
|
+
if (Object.hasOwn(refinements, field) && !refinements[field](value))
|
|
33
|
+
return false;
|
|
34
|
+
const type = Object.hasOwn(fields, field) ? fields[field] : undefined;
|
|
35
|
+
if (!isTypeName(type) || type === UNCHECKED_TYPE_NAME || value === null)
|
|
36
|
+
return true;
|
|
37
|
+
return TYPE_NAME_GUARDS.get(type)?.(value) ?? false;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=patch-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-validation.js","sourceRoot":"","sources":["../../../src/db/models/patch-validation.ts"],"names":[],"mappings":";;AAkDA,oDAeC;AAjED,6FAKmD;AAOnD,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAElC,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC;AACpC,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAqB;IACnD,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACpB,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACpB,CAAC,SAAS,EAAE,SAAS,CAAC;IACtB,CAAC,MAAM,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAEH,SAAS,UAAU,CAAC,IAA2B;IAC7C,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC;AAClC,CAAC;AAWD,SAAgB,oBAAoB,CAClC,KAAuB,EACvB,KAAqB,EACrB,cAAoD,EAAE;IAEtD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,2CAAW,EAAC,KAAK,EAAE,mDAAmB,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE;QACpD,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QACrC,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;YACjE,OAAO,KAAK,CAAC;QACf,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,mBAAmB,IAAI,KAAK,KAAK,IAAI;YACrE,OAAO,IAAI,CAAC;QACd,OAAO,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -5,18 +5,20 @@ declare const PlanMigrationModel_base: {
|
|
|
5
5
|
readonly table: import("@antelopejs/interface-database").Table<PlanMigration>;
|
|
6
6
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
7
7
|
get(id: string): PromiseLike<PlanMigration | undefined>;
|
|
8
|
-
getBy(index: keyof PlanMigration, ...keys:
|
|
8
|
+
getBy(index: keyof PlanMigration, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<PlanMigration[]>;
|
|
9
9
|
getAll(): PromiseLike<PlanMigration[]>;
|
|
10
10
|
insert(obj: DeepPartial<PlanMigration> | DeepPartial<PlanMigration>[], options?: ValidateOptions): Promise<string[]>;
|
|
11
11
|
update(id: string, obj: DeepPartial<PlanMigration>, options?: ValidateOptions): Promise<number>;
|
|
12
|
-
update(obj: DeepPartial<PlanMigration
|
|
12
|
+
update(obj: DeepPartial<PlanMigration> & {
|
|
13
|
+
_id: string;
|
|
14
|
+
}, options?: ValidateOptions): Promise<number>;
|
|
13
15
|
delete(id: string): Promise<number>;
|
|
14
16
|
};
|
|
15
|
-
readonly schemaName: string;
|
|
17
|
+
readonly schemaName: string | undefined;
|
|
16
18
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<PlanMigration>;
|
|
17
|
-
fromPlainData(obj:
|
|
19
|
+
fromPlainData(obj: PlanMigration | import("@antelopejs/interface-database-decorators").PlainData<PlanMigration>): PlanMigration;
|
|
18
20
|
fromDatabase(obj: any): PlanMigration | undefined;
|
|
19
|
-
toDatabase(obj:
|
|
21
|
+
toDatabase(obj: PlanMigration | import("@antelopejs/interface-database-decorators").PlainData<PlanMigration>): import("@antelopejs/interface-database-decorators").StoredRow<PlanMigration>;
|
|
20
22
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
21
23
|
};
|
|
22
24
|
export declare class PlanMigrationModel extends PlanMigrationModel_base {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type IndexKey } from "@antelopejs/interface-database-decorators";
|
|
1
2
|
import { Plan, type PlanFeatureValue } from "../tables/plans.table";
|
|
2
3
|
export interface ResolvedPlanInheritance {
|
|
3
4
|
permissions: string[];
|
|
@@ -8,23 +9,25 @@ declare const PlanModel_base: {
|
|
|
8
9
|
readonly table: import("@antelopejs/interface-database").Table<Plan>;
|
|
9
10
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
10
11
|
get(id: string): PromiseLike<Plan | undefined>;
|
|
11
|
-
getBy(index:
|
|
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" | "localize", ...keys: IndexKey[]): PromiseLike<Plan[]>;
|
|
12
13
|
getAll(): PromiseLike<Plan[]>;
|
|
13
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[]>;
|
|
14
15
|
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
|
|
16
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Plan> & {
|
|
17
|
+
_id: string;
|
|
18
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
16
19
|
delete(id: string): Promise<number>;
|
|
17
20
|
};
|
|
18
|
-
readonly schemaName: string;
|
|
21
|
+
readonly schemaName: string | undefined;
|
|
19
22
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<Plan>;
|
|
20
|
-
fromPlainData(obj:
|
|
23
|
+
fromPlainData(obj: Plan | import("@antelopejs/interface-database-decorators").PlainData<Plan>): Plan;
|
|
21
24
|
fromDatabase(obj: any): Plan | undefined;
|
|
22
|
-
toDatabase(obj:
|
|
25
|
+
toDatabase(obj: Plan | import("@antelopejs/interface-database-decorators").PlainData<Plan>): import("@antelopejs/interface-database-decorators").StoredRow<Plan>;
|
|
23
26
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
24
27
|
};
|
|
25
28
|
export declare class PlanModel extends PlanModel_base {
|
|
26
29
|
get(id: string): Promise<Plan | undefined>;
|
|
27
|
-
getBy(index: keyof Plan, ...keys:
|
|
30
|
+
getBy(index: Extract<keyof Plan, string>, ...keys: IndexKey[]): Promise<Plan[]>;
|
|
28
31
|
getAll(): Promise<Plan[]>;
|
|
29
32
|
findNotDeleted(): Promise<Plan[]>;
|
|
30
33
|
findActiveNotDeleted(): Promise<Plan[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plans.model.js","sourceRoot":"","sources":["../../../src/db/models/plans.model.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"plans.model.js","sourceRoot":"","sources":["../../../src/db/models/plans.model.ts"],"names":[],"mappings":";;;AAAA,6FAGmD;AACnD,uDAM+B;AAG/B,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAQjC,SAAS,gBAAgB,CAAC,IAAU;IAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,kCAAoB,EAAE,mCAAqB,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,SAAS,CAAC,IAAe;IAChC,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;SACzC,MAAM,CAAC,CAAC,GAAG,EAAe,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC;SAC/C,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC3B,CAAC;AAUD,MAAa,SAAU,SAAQ,IAAA,8CAAc,EAAC,kBAAI,EAAE,4BAAc,CAAC;IACxD,KAAK,CAAC,GAAG,CAAC,EAAU;QAC3B,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjC,OAAO,IAAI,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAEQ,KAAK,CAAC,KAAK,CAClB,KAAkC,EAClC,GAAG,IAAgB;QAEnB,OAAO,CAAC,MAAM,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAA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AG,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;QACD,OAAO;YACL,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC;YACpC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC5D,SAAS;gBACT,KAAK;aACN,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC;CACF;AAjFD,8BAiFC"}
|
|
@@ -14,18 +14,20 @@ declare const PlatformNoteModel_base: {
|
|
|
14
14
|
readonly table: import("@antelopejs/interface-database").Table<PlatformNote>;
|
|
15
15
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
16
16
|
get(id: string): PromiseLike<PlatformNote | undefined>;
|
|
17
|
-
getBy(index: keyof PlatformNote, ...keys:
|
|
17
|
+
getBy(index: keyof PlatformNote, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<PlatformNote[]>;
|
|
18
18
|
getAll(): PromiseLike<PlatformNote[]>;
|
|
19
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
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
|
|
21
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<PlatformNote> & {
|
|
22
|
+
_id: string;
|
|
23
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
22
24
|
delete(id: string): Promise<number>;
|
|
23
25
|
};
|
|
24
|
-
readonly schemaName: string;
|
|
26
|
+
readonly schemaName: string | undefined;
|
|
25
27
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<PlatformNote>;
|
|
26
|
-
fromPlainData(obj:
|
|
28
|
+
fromPlainData(obj: PlatformNote | import("@antelopejs/interface-database-decorators").PlainData<PlatformNote>): PlatformNote;
|
|
27
29
|
fromDatabase(obj: any): PlatformNote | undefined;
|
|
28
|
-
toDatabase(obj:
|
|
30
|
+
toDatabase(obj: PlatformNote | import("@antelopejs/interface-database-decorators").PlainData<PlatformNote>): import("@antelopejs/interface-database-decorators").StoredRow<PlatformNote>;
|
|
29
31
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
30
32
|
};
|
|
31
33
|
export declare class PlatformNoteModel extends PlatformNoteModel_base {
|
|
@@ -4,18 +4,20 @@ declare const RefundModel_base: {
|
|
|
4
4
|
readonly table: import("@antelopejs/interface-database").Table<Refund>;
|
|
5
5
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
6
6
|
get(id: string): PromiseLike<Refund | undefined>;
|
|
7
|
-
getBy(index: keyof Refund, ...keys:
|
|
7
|
+
getBy(index: keyof Refund, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<Refund[]>;
|
|
8
8
|
getAll(): PromiseLike<Refund[]>;
|
|
9
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
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
|
|
11
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Refund> & {
|
|
12
|
+
_id: string;
|
|
13
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
14
|
delete(id: string): Promise<number>;
|
|
13
15
|
};
|
|
14
|
-
readonly schemaName: string;
|
|
16
|
+
readonly schemaName: string | undefined;
|
|
15
17
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<Refund>;
|
|
16
|
-
fromPlainData(obj:
|
|
18
|
+
fromPlainData(obj: Refund | import("@antelopejs/interface-database-decorators").PlainData<Refund>): Refund;
|
|
17
19
|
fromDatabase(obj: any): Refund | undefined;
|
|
18
|
-
toDatabase(obj:
|
|
20
|
+
toDatabase(obj: Refund | import("@antelopejs/interface-database-decorators").PlainData<Refund>): import("@antelopejs/interface-database-decorators").StoredRow<Refund>;
|
|
19
21
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
20
22
|
};
|
|
21
23
|
export declare class RefundModel extends RefundModel_base {
|
|
@@ -10,18 +10,20 @@ declare const SegmentModel_base: {
|
|
|
10
10
|
readonly table: import("@antelopejs/interface-database").Table<Segment>;
|
|
11
11
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
12
12
|
get(id: string): PromiseLike<Segment | undefined>;
|
|
13
|
-
getBy(index: keyof Segment, ...keys:
|
|
13
|
+
getBy(index: keyof Segment, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<Segment[]>;
|
|
14
14
|
getAll(): PromiseLike<Segment[]>;
|
|
15
15
|
insert(obj: DeepPartial<Segment> | DeepPartial<Segment>[], options?: ValidateOptions): Promise<string[]>;
|
|
16
16
|
update(id: string, obj: DeepPartial<Segment>, options?: ValidateOptions): Promise<number>;
|
|
17
|
-
update(obj: DeepPartial<Segment
|
|
17
|
+
update(obj: DeepPartial<Segment> & {
|
|
18
|
+
_id: string;
|
|
19
|
+
}, options?: ValidateOptions): Promise<number>;
|
|
18
20
|
delete(id: string): Promise<number>;
|
|
19
21
|
};
|
|
20
|
-
readonly schemaName: string;
|
|
22
|
+
readonly schemaName: string | undefined;
|
|
21
23
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<Segment>;
|
|
22
|
-
fromPlainData(obj:
|
|
24
|
+
fromPlainData(obj: Segment | import("@antelopejs/interface-database-decorators").PlainData<Segment>): Segment;
|
|
23
25
|
fromDatabase(obj: any): Segment | undefined;
|
|
24
|
-
toDatabase(obj:
|
|
26
|
+
toDatabase(obj: Segment | import("@antelopejs/interface-database-decorators").PlainData<Segment>): import("@antelopejs/interface-database-decorators").StoredRow<Segment>;
|
|
25
27
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
26
28
|
};
|
|
27
29
|
export declare class SegmentModel extends SegmentModel_base {
|
|
@@ -5,6 +5,7 @@ exports.appendSegmentCountPoint = appendSegmentCountPoint;
|
|
|
5
5
|
const node_crypto_1 = require("node:crypto");
|
|
6
6
|
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
7
7
|
const segments_table_1 = require("../tables/segments.table");
|
|
8
|
+
const patch_validation_1 = require("./patch-validation");
|
|
8
9
|
exports.SEGMENT_COUNT_HISTORY_DAYS = 30;
|
|
9
10
|
const ISO_DAY_LENGTH = 10;
|
|
10
11
|
function appendSegmentCountPoint(history, count, evaluatedAt) {
|
|
@@ -15,19 +16,18 @@ function appendSegmentCountPoint(history, count, evaluatedAt) {
|
|
|
15
16
|
.slice(-exports.SEGMENT_COUNT_HISTORY_DAYS);
|
|
16
17
|
}
|
|
17
18
|
class SegmentModel extends (0, interface_database_decorators_1.BasicDataModel)(segments_table_1.Segment, segments_table_1.segmentsTableName) {
|
|
18
|
-
async update(
|
|
19
|
-
const id
|
|
19
|
+
async update(...args) {
|
|
20
|
+
const [id, patch, options] = isKeyedUpdate(args)
|
|
21
|
+
? args
|
|
22
|
+
: [args[0]._id, args[0], args[1]];
|
|
20
23
|
if (!id)
|
|
21
24
|
throw new Error("Segment identity is required");
|
|
22
|
-
return this.updateRevision(id,
|
|
23
|
-
? patchOrOptions
|
|
24
|
-
: idOrPatch, typeof idOrPatch === "string"
|
|
25
|
-
? options
|
|
26
|
-
: patchOrOptions);
|
|
25
|
+
return this.updateRevision(id, patch, options);
|
|
27
26
|
}
|
|
28
27
|
async updateRevision(id, patch, options) {
|
|
29
28
|
if (options?.validate &&
|
|
30
|
-
!SegmentModel.validate(patch, { partial: true }).ok
|
|
29
|
+
!(SegmentModel.validate(patch, { partial: true }).ok &&
|
|
30
|
+
(0, patch_validation_1.matchesDeclaredTypes)(segments_table_1.Segment, patch)))
|
|
31
31
|
throw new Error("Invalid segment patch");
|
|
32
32
|
const current = await this.get(id);
|
|
33
33
|
if (!current)
|
|
@@ -72,11 +72,14 @@ class SegmentModel extends (0, interface_database_decorators_1.BasicDataModel)(s
|
|
|
72
72
|
async getMany(ids) {
|
|
73
73
|
if (ids.length === 0)
|
|
74
74
|
return [];
|
|
75
|
-
const rows = await this.table.getAll(ids).run();
|
|
75
|
+
const rows = await this.table.getAll([...ids]).run();
|
|
76
76
|
return rows
|
|
77
77
|
.map((row) => SegmentModel.fromDatabase(row))
|
|
78
78
|
.filter((s) => s !== undefined);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
exports.SegmentModel = SegmentModel;
|
|
82
|
+
function isKeyedUpdate(args) {
|
|
83
|
+
return typeof args[0] === "string";
|
|
84
|
+
}
|
|
82
85
|
//# sourceMappingURL=segments.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segments.model.js","sourceRoot":"","sources":["../../../src/db/models/segments.model.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"segments.model.js","sourceRoot":"","sources":["../../../src/db/models/segments.model.ts"],"names":[],"mappings":";;;AA8BA,0DAUC;AAxCD,6CAAyC;AACzC,6FAKmD;AACnD,6DAIkC;AAClC,yDAA0D;A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C3B,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,UAAU;YACzB,gBAAgB,EAAE,OAAO,CAAC,QAAQ;YAClC,YAAY,EAAE,IAAA,wBAAU,GAAE;YAC1B,KAAK,EAAE;gBACL,oBAAoB,EAAE,UAAU;gBAChC,cAAc,EAAE,KAAK;gBACrB,eAAe,EAAE,WAAW;gBAC5B,gBAAgB,EAAE,KAAK,CAAC,UAAU,IAAI,IAAI;gBAC1C,YAAY,EAAE,uBAAuB,CACnC,OAAO,CAAC,YAAY,EACpB,KAAK,EACL,WAAW,CACZ;aACF;SACF,CAAC;aACD,GAAG,EAAE,CAAC;QACT,IAAI,OAAO,KAAK,SAAS;YACvB,MAAM,IAAI,KAAK,CAAC,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,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QACrD,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;AAhGD,oCAgGC;AAED,SAAS,aAAa,CACpB,IAA4B;IAE5B,OAAO,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC;AACrC,CAAC"}
|
|
@@ -5,18 +5,20 @@ declare const StripeWebhookEventModel_base: {
|
|
|
5
5
|
readonly table: import("@antelopejs/interface-database").Table<StripeWebhookEvent>;
|
|
6
6
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
7
7
|
get(id: string): PromiseLike<StripeWebhookEvent | undefined>;
|
|
8
|
-
getBy(index: keyof StripeWebhookEvent, ...keys:
|
|
8
|
+
getBy(index: keyof StripeWebhookEvent, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<StripeWebhookEvent[]>;
|
|
9
9
|
getAll(): PromiseLike<StripeWebhookEvent[]>;
|
|
10
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
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
|
|
12
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<StripeWebhookEvent> & {
|
|
13
|
+
_id: string;
|
|
14
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
13
15
|
delete(id: string): Promise<number>;
|
|
14
16
|
};
|
|
15
|
-
readonly schemaName: string;
|
|
17
|
+
readonly schemaName: string | undefined;
|
|
16
18
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<StripeWebhookEvent>;
|
|
17
|
-
fromPlainData(obj:
|
|
19
|
+
fromPlainData(obj: StripeWebhookEvent | import("@antelopejs/interface-database-decorators").PlainData<StripeWebhookEvent>): StripeWebhookEvent;
|
|
18
20
|
fromDatabase(obj: any): StripeWebhookEvent | undefined;
|
|
19
|
-
toDatabase(obj:
|
|
21
|
+
toDatabase(obj: StripeWebhookEvent | import("@antelopejs/interface-database-decorators").PlainData<StripeWebhookEvent>): import("@antelopejs/interface-database-decorators").StoredRow<StripeWebhookEvent>;
|
|
20
22
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
21
23
|
};
|
|
22
24
|
export declare class StripeWebhookEventModel extends StripeWebhookEventModel_base {
|
|
@@ -4,18 +4,20 @@ declare const TenantBillingInfoModel_base: {
|
|
|
4
4
|
readonly table: import("@antelopejs/interface-database").Table<TenantBillingInfo>;
|
|
5
5
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
6
6
|
get(id: string): PromiseLike<TenantBillingInfo | undefined>;
|
|
7
|
-
getBy(index: keyof TenantBillingInfo, ...keys:
|
|
7
|
+
getBy(index: keyof TenantBillingInfo, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<TenantBillingInfo[]>;
|
|
8
8
|
getAll(): PromiseLike<TenantBillingInfo[]>;
|
|
9
9
|
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<TenantBillingInfo> | import("@antelopejs/interface-database-decorators").DeepPartial<TenantBillingInfo>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
10
10
|
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<TenantBillingInfo>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
11
|
-
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<TenantBillingInfo
|
|
11
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<TenantBillingInfo> & {
|
|
12
|
+
_id: string;
|
|
13
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
14
|
delete(id: string): Promise<number>;
|
|
13
15
|
};
|
|
14
|
-
readonly schemaName: string;
|
|
16
|
+
readonly schemaName: string | undefined;
|
|
15
17
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<TenantBillingInfo>;
|
|
16
|
-
fromPlainData(obj:
|
|
18
|
+
fromPlainData(obj: TenantBillingInfo | import("@antelopejs/interface-database-decorators").PlainData<TenantBillingInfo>): TenantBillingInfo;
|
|
17
19
|
fromDatabase(obj: any): TenantBillingInfo | undefined;
|
|
18
|
-
toDatabase(obj:
|
|
20
|
+
toDatabase(obj: TenantBillingInfo | import("@antelopejs/interface-database-decorators").PlainData<TenantBillingInfo>): import("@antelopejs/interface-database-decorators").StoredRow<TenantBillingInfo>;
|
|
19
21
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
20
22
|
};
|
|
21
23
|
export declare class TenantBillingInfoModel extends TenantBillingInfoModel_base {
|