@webda/core 4.0.0-beta.7 → 4.0.0-beta.9
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/lib/application/application.d.ts +19 -0
- package/lib/application/application.d.ts.map +1 -1
- package/lib/application/application.js +52 -9
- package/lib/application/application.js.map +1 -1
- package/lib/application/model-types.d.ts +63 -0
- package/lib/application/model-types.d.ts.map +1 -0
- package/lib/application/model-types.js +59 -0
- package/lib/application/model-types.js.map +1 -0
- package/lib/application/unpackedapplication.d.ts.map +1 -1
- package/lib/application/unpackedapplication.js +5 -4
- package/lib/application/unpackedapplication.js.map +1 -1
- package/lib/bin/cli.d.ts +18 -0
- package/lib/bin/cli.d.ts.map +1 -1
- package/lib/bin/cli.js +38 -3
- package/lib/bin/cli.js.map +1 -1
- package/lib/core/operations.d.ts +17 -0
- package/lib/core/operations.d.ts.map +1 -1
- package/lib/core/operations.js +1 -1
- package/lib/core/operations.js.map +1 -1
- package/lib/index.d.ts +5 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/models/decorator.d.ts +21 -0
- package/lib/models/decorator.d.ts.map +1 -1
- package/lib/models/decorator.js +18 -0
- package/lib/models/decorator.js.map +1 -1
- package/lib/rest/restoperationstransport.service.d.ts +6 -0
- package/lib/rest/restoperationstransport.service.d.ts.map +1 -1
- package/lib/rest/restoperationstransport.service.js +31 -2
- package/lib/rest/restoperationstransport.service.js.map +1 -1
- package/lib/rest/router.service.d.ts.map +1 -1
- package/lib/rest/router.service.js +5 -2
- package/lib/rest/router.service.js.map +1 -1
- package/lib/services/binary.service.d.ts +1 -1
- package/lib/services/binary.service.d.ts.map +1 -1
- package/lib/services/binary.service.js.map +1 -1
- package/lib/services/httpserver.service.d.ts.map +1 -1
- package/lib/services/httpserver.service.js +5 -0
- package/lib/services/httpserver.service.js.map +1 -1
- package/lib/services/service.d.ts.map +1 -1
- package/lib/services/service.js +4 -1
- package/lib/services/service.js.map +1 -1
- package/lib/services/servicecommands.d.ts.map +1 -1
- package/lib/services/servicecommands.js +14 -1
- package/lib/services/servicecommands.js.map +1 -1
- package/lib/stores/capability.d.ts +16 -0
- package/lib/stores/capability.d.ts.map +1 -0
- package/lib/stores/capability.js +5 -0
- package/lib/stores/capability.js.map +1 -0
- package/lib/stores/memory.service.d.ts +30 -1
- package/lib/stores/memory.service.d.ts.map +1 -1
- package/lib/stores/memory.service.js +47 -1
- package/lib/stores/memory.service.js.map +1 -1
- package/lib/stores/migration.d.ts +306 -0
- package/lib/stores/migration.d.ts.map +1 -0
- package/lib/stores/migration.js +280 -0
- package/lib/stores/migration.js.map +1 -0
- package/lib/stores/store.d.ts +151 -17
- package/lib/stores/store.d.ts.map +1 -1
- package/lib/stores/store.js +421 -21
- package/lib/stores/store.js.map +1 -1
- package/lib/test/index.d.ts +2 -0
- package/lib/test/index.d.ts.map +1 -1
- package/lib/test/index.js +3 -0
- package/lib/test/index.js.map +1 -1
- package/lib/test/legacy-types.d.ts +146 -0
- package/lib/test/legacy-types.d.ts.map +1 -0
- package/lib/test/legacy-types.fixture.model.d.ts +38 -0
- package/lib/test/legacy-types.fixture.model.d.ts.map +1 -0
- package/lib/test/legacy-types.fixture.model.js +38 -0
- package/lib/test/legacy-types.fixture.model.js.map +1 -0
- package/lib/test/legacy-types.js +481 -0
- package/lib/test/legacy-types.js.map +1 -0
- package/package.json +11 -11
- package/webda.module.json +48 -22
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { ModelClass } from "@webda/models";
|
|
2
|
+
import { type MigrationReport } from "../stores/migration.js";
|
|
3
|
+
import type { Store } from "../stores/store.js";
|
|
4
|
+
/**
|
|
5
|
+
* `models` of a store holding the fixture: two models sharing one table, V3Animal its root
|
|
6
|
+
*/
|
|
7
|
+
export declare const LEGACY_TYPE_MODELS: string[];
|
|
8
|
+
/**
|
|
9
|
+
* Rows as Webda 3 stored them: short, lower-case, upper-case, aliased, untyped and unknown types, and a type of an
|
|
10
|
+
* ancestor of the table root (`UuidModel`), which belongs to the root like an untyped row
|
|
11
|
+
*/
|
|
12
|
+
export declare const LEGACY_TYPE_ROWS: {
|
|
13
|
+
key: string;
|
|
14
|
+
data: Record<string, any>;
|
|
15
|
+
}[];
|
|
16
|
+
/**
|
|
17
|
+
* Row whose type matches two models (both declare the alias `Webda/Creature`): ambiguous, so left untouched
|
|
18
|
+
*
|
|
19
|
+
* Not part of {@link LEGACY_TYPE_ROWS}: only the migration check seeds it.
|
|
20
|
+
*/
|
|
21
|
+
export declare const LEGACY_TYPE_AMBIGUOUS_ROW: {
|
|
22
|
+
key: string;
|
|
23
|
+
data: {
|
|
24
|
+
uuid: string;
|
|
25
|
+
__type: string;
|
|
26
|
+
name: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Totals of a migration report, summed over the tables
|
|
31
|
+
*/
|
|
32
|
+
export interface LegacyTypeTotals {
|
|
33
|
+
/** Rows read */
|
|
34
|
+
scanned: number;
|
|
35
|
+
/** Rows rewritten */
|
|
36
|
+
updated: number;
|
|
37
|
+
/** Count by change */
|
|
38
|
+
byChange: Record<string, number>;
|
|
39
|
+
/** Untouched rows by stored type */
|
|
40
|
+
unknown: Record<string, number>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Exact `types` migration totals over {@link LEGACY_TYPE_ROWS}
|
|
44
|
+
*/
|
|
45
|
+
export declare const LEGACY_TYPE_REPORT: LegacyTypeTotals;
|
|
46
|
+
/**
|
|
47
|
+
* Register the fixture models in the current application (once), with the runtime Metadata the module loader sets
|
|
48
|
+
*/
|
|
49
|
+
export declare function registerLegacyTypeFixtures(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Sum a migration report over its tables
|
|
52
|
+
* @param report - the report
|
|
53
|
+
* @returns the totals
|
|
54
|
+
*/
|
|
55
|
+
export declare function sumMigrationReport(report: MigrationReport): LegacyTypeTotals;
|
|
56
|
+
/**
|
|
57
|
+
* What a store package provides to run the legacy types conformance suite
|
|
58
|
+
*/
|
|
59
|
+
export interface LegacyTypesHarness {
|
|
60
|
+
/**
|
|
61
|
+
* Create, register in the Core, resolve and initialize an empty store of the type under test
|
|
62
|
+
* @param name - unique service name
|
|
63
|
+
* @param models - the `models` parameter
|
|
64
|
+
* @param parameters - extra store parameters (e.g. `table`, `tables`)
|
|
65
|
+
* @returns the store
|
|
66
|
+
*/
|
|
67
|
+
createStore(name: string, models: string[], parameters?: Record<string, any>): Promise<Store>;
|
|
68
|
+
/**
|
|
69
|
+
* Write rows exactly as Webda 3 stored them (plain JSON, `__type` as given), bypassing the repositories
|
|
70
|
+
*
|
|
71
|
+
* Inserts or REPLACES any existing row with the same key (an upsert): the migration check re-seeds a row.
|
|
72
|
+
* @param store - the store
|
|
73
|
+
* @param table - the table, from {@link LegacyTypesHarness.tableOf}
|
|
74
|
+
* @param rows - rows by key
|
|
75
|
+
*/
|
|
76
|
+
seedRaw(store: Store, table: string, rows: {
|
|
77
|
+
key: string;
|
|
78
|
+
data: Record<string, any>;
|
|
79
|
+
}[]): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Table holding the rows of a model (default: the first raw table of the store)
|
|
82
|
+
* @param store - the store
|
|
83
|
+
* @param model - the model
|
|
84
|
+
* @returns the table name
|
|
85
|
+
*/
|
|
86
|
+
tableOf?(store: Store, model: ModelClass): string;
|
|
87
|
+
/**
|
|
88
|
+
* Lease duration of the lease check, in ms: raise it for slow (remote) backends
|
|
89
|
+
*
|
|
90
|
+
* @default 1000
|
|
91
|
+
*/
|
|
92
|
+
leaseDuration?: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Reads see exactly the rows of each model, as the right class; bulk statements and deletes too
|
|
96
|
+
* @param harness - the harness
|
|
97
|
+
*/
|
|
98
|
+
export declare function checkLegacyTypeVisibility(harness: LegacyTypesHarness): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Saving a legacy row writes its current identifier; a subclass row keeps its subclass identifier
|
|
101
|
+
* @param harness - the harness
|
|
102
|
+
*/
|
|
103
|
+
export declare function checkLegacyTypeNormalization(harness: LegacyTypesHarness): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* The `types` report is exact; a dry run writes nothing; a second run updates nothing; a Webda 4 envelope keeps its
|
|
106
|
+
* value; an ambiguous type is counted and left alone
|
|
107
|
+
* @param harness - the harness
|
|
108
|
+
*/
|
|
109
|
+
export declare function checkLegacyTypeMigration(harness: LegacyTypesHarness): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* A run interrupted after one page resumes and ends with the same totals
|
|
112
|
+
* @param harness - the harness
|
|
113
|
+
*/
|
|
114
|
+
export declare function checkLegacyTypeResume(harness: LegacyTypesHarness): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* A second runner fails fast; an expired lease is taken over; the stale runner stops without writing
|
|
117
|
+
*
|
|
118
|
+
* Both runners use a patcher that always patches, so a stale runner that kept writing would be caught.
|
|
119
|
+
* @param harness - the harness
|
|
120
|
+
*/
|
|
121
|
+
export declare function checkLegacyTypeLease(harness: LegacyTypesHarness): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* The startup check WARNs once with the counts; a clean store stays silent
|
|
124
|
+
* @param harness - the harness
|
|
125
|
+
*/
|
|
126
|
+
export declare function checkLegacyTypeStartup(harness: LegacyTypesHarness): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Every check of the suite, by name
|
|
129
|
+
*/
|
|
130
|
+
export declare const LEGACY_TYPE_CHECKS: {
|
|
131
|
+
name: string;
|
|
132
|
+
check: (harness: LegacyTypesHarness) => Promise<void>;
|
|
133
|
+
}[];
|
|
134
|
+
/**
|
|
135
|
+
* Run the whole suite
|
|
136
|
+
*
|
|
137
|
+
* A plain function rather than a test suite so store packages share it without duplicating test classes across
|
|
138
|
+
* module resolutions.
|
|
139
|
+
* @param harness - the harness
|
|
140
|
+
* @param options - names of the checks to skip, with a documented reason
|
|
141
|
+
* @param options.skip - check names
|
|
142
|
+
*/
|
|
143
|
+
export declare function checkLegacyTypes(harness: LegacyTypesHarness, options?: {
|
|
144
|
+
skip?: string[];
|
|
145
|
+
}): Promise<void>;
|
|
146
|
+
//# sourceMappingURL=legacy-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-types.d.ts","sourceRoot":"","sources":["../../src/test/legacy-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAOhD;;GAEG;AACH,eAAO,MAAM,kBAAkB,UAAsC,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,EAaxE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;IACpC,GAAG;IACH,IAAI;QAAI,IAAI;QAAQ,MAAM;QAAoB,IAAI;;CACnD,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAchC,CAAC;AAEF;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CA6BjD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,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vF;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,EAOvG,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAKpH"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { UuidModel } from "@webda/models";
|
|
2
|
+
/**
|
|
3
|
+
* Root model of the legacy types fixture: shares its table with {@link V3Plant}
|
|
4
|
+
*
|
|
5
|
+
* @WebdaIgnore
|
|
6
|
+
*/
|
|
7
|
+
export declare class V3Animal extends UuidModel {
|
|
8
|
+
/**
|
|
9
|
+
* Label
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Subclass of the legacy types fixture
|
|
15
|
+
*
|
|
16
|
+
* @WebdaIgnore
|
|
17
|
+
*/
|
|
18
|
+
export declare class V3Dog extends V3Animal {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Second-level subclass of the legacy types fixture
|
|
22
|
+
*
|
|
23
|
+
* @WebdaIgnore
|
|
24
|
+
*/
|
|
25
|
+
export declare class V3Puppy extends V3Dog {
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Second model of the shared table, renamed from `Webda/Flora`
|
|
29
|
+
*
|
|
30
|
+
* @WebdaIgnore
|
|
31
|
+
*/
|
|
32
|
+
export declare class V3Plant extends UuidModel {
|
|
33
|
+
/**
|
|
34
|
+
* Label
|
|
35
|
+
*/
|
|
36
|
+
name: string;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=legacy-types.fixture.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-types.fixture.model.d.ts","sourceRoot":"","sources":["../../src/test/legacy-types.fixture.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,SAAS;IACrC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,qBAAa,KAAM,SAAQ,QAAQ;CAAG;AAEtC;;;;GAIG;AACH,qBAAa,OAAQ,SAAQ,KAAK;CAAG;AAErC;;;;GAIG;AACH,qBAAa,OAAQ,SAAQ,SAAS;IACpC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { UuidModel } from "@webda/models";
|
|
2
|
+
/**
|
|
3
|
+
* Root model of the legacy types fixture: shares its table with {@link V3Plant}
|
|
4
|
+
*
|
|
5
|
+
* @WebdaIgnore
|
|
6
|
+
*/
|
|
7
|
+
export class V3Animal extends UuidModel {
|
|
8
|
+
/**
|
|
9
|
+
* Label
|
|
10
|
+
*/
|
|
11
|
+
name;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Subclass of the legacy types fixture
|
|
15
|
+
*
|
|
16
|
+
* @WebdaIgnore
|
|
17
|
+
*/
|
|
18
|
+
export class V3Dog extends V3Animal {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Second-level subclass of the legacy types fixture
|
|
22
|
+
*
|
|
23
|
+
* @WebdaIgnore
|
|
24
|
+
*/
|
|
25
|
+
export class V3Puppy extends V3Dog {
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Second model of the shared table, renamed from `Webda/Flora`
|
|
29
|
+
*
|
|
30
|
+
* @WebdaIgnore
|
|
31
|
+
*/
|
|
32
|
+
export class V3Plant extends UuidModel {
|
|
33
|
+
/**
|
|
34
|
+
* Label
|
|
35
|
+
*/
|
|
36
|
+
name;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=legacy-types.fixture.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-types.fixture.model.js","sourceRoot":"","sources":["../../src/test/legacy-types.fixture.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAS;IACrC;;OAEG;IACH,IAAI,CAAS;CACd;AAED;;;;GAIG;AACH,MAAM,OAAO,KAAM,SAAQ,QAAQ;CAAG;AAEtC;;;;GAIG;AACH,MAAM,OAAO,OAAQ,SAAQ,KAAK;CAAG;AAErC;;;;GAIG;AACH,MAAM,OAAO,OAAQ,SAAQ,SAAS;IACpC;;OAEG;IACH,IAAI,CAAS;CACd"}
|