@geexcode/geex-angular 0.0.2 → 0.0.4
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/dist/index.d.mts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +13 -2
- package/dist/index.mjs +13 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2,12 +2,29 @@ import { WritableSignal, InjectionToken, Injector, Provider } from '@angular/cor
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
|
|
4
4
|
interface Tenant {
|
|
5
|
+
/** Unique identifier */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Tenant code */
|
|
5
8
|
code: string;
|
|
9
|
+
/** Tenant display name */
|
|
6
10
|
name: string;
|
|
11
|
+
/** Whether the tenant is enabled */
|
|
12
|
+
isEnabled?: boolean;
|
|
13
|
+
/** Creation timestamp */
|
|
14
|
+
createdOn?: any;
|
|
15
|
+
[key: string]: any;
|
|
7
16
|
}
|
|
8
17
|
interface Org {
|
|
18
|
+
/** Unique identifier */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Organization type */
|
|
21
|
+
orgType?: any;
|
|
22
|
+
/** Hierarchical code */
|
|
9
23
|
code: string;
|
|
24
|
+
/** Organization name */
|
|
10
25
|
name: string;
|
|
26
|
+
/** Parent organization code */
|
|
27
|
+
parentOrgCode?: string;
|
|
11
28
|
[key: string]: any;
|
|
12
29
|
}
|
|
13
30
|
interface UserOrgMembership {
|
|
@@ -74,6 +91,7 @@ interface UiModule extends GeexModule {
|
|
|
74
91
|
activeRoutedComponent?: any;
|
|
75
92
|
}
|
|
76
93
|
type GeexModules<TExtensionModules extends Record<string, GeexModule> = {}> = {
|
|
94
|
+
init: () => Promise<any>;
|
|
77
95
|
tenant: TenantModule;
|
|
78
96
|
auth: AuthModule;
|
|
79
97
|
identity: IdentityModule;
|
|
@@ -81,11 +99,19 @@ type GeexModules<TExtensionModules extends Record<string, GeexModule> = {}> = {
|
|
|
81
99
|
settings: SettingsModule;
|
|
82
100
|
ui: UiModule;
|
|
83
101
|
} & TExtensionModules;
|
|
84
|
-
type GeexModule<TExtension = any> = {
|
|
102
|
+
type GeexModule<TExtension = any> = {
|
|
103
|
+
/**
|
|
104
|
+
* A module combines both reactive state (signals) and business logic methods.
|
|
105
|
+
* Concrete modules can extend this interface to expose their own signals & methods.
|
|
106
|
+
* This empty base exists mainly for typing convenience and future extension.
|
|
107
|
+
*/
|
|
108
|
+
init?: () => Promise<any>;
|
|
109
|
+
} & TExtension;
|
|
85
110
|
|
|
86
111
|
type GeexOverrides<TExtensionModules extends Record<string, GeexModule> = {}> = Partial<GeexModules<TExtensionModules>>;
|
|
87
112
|
declare let geex: GeexModules;
|
|
88
113
|
declare let Geex: InjectionToken<{
|
|
114
|
+
init: () => Promise<any>;
|
|
89
115
|
tenant: TenantModule;
|
|
90
116
|
auth: AuthModule;
|
|
91
117
|
identity: IdentityModule;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,29 @@ import { WritableSignal, InjectionToken, Injector, Provider } from '@angular/cor
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
|
|
4
4
|
interface Tenant {
|
|
5
|
+
/** Unique identifier */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Tenant code */
|
|
5
8
|
code: string;
|
|
9
|
+
/** Tenant display name */
|
|
6
10
|
name: string;
|
|
11
|
+
/** Whether the tenant is enabled */
|
|
12
|
+
isEnabled?: boolean;
|
|
13
|
+
/** Creation timestamp */
|
|
14
|
+
createdOn?: any;
|
|
15
|
+
[key: string]: any;
|
|
7
16
|
}
|
|
8
17
|
interface Org {
|
|
18
|
+
/** Unique identifier */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Organization type */
|
|
21
|
+
orgType?: any;
|
|
22
|
+
/** Hierarchical code */
|
|
9
23
|
code: string;
|
|
24
|
+
/** Organization name */
|
|
10
25
|
name: string;
|
|
26
|
+
/** Parent organization code */
|
|
27
|
+
parentOrgCode?: string;
|
|
11
28
|
[key: string]: any;
|
|
12
29
|
}
|
|
13
30
|
interface UserOrgMembership {
|
|
@@ -74,6 +91,7 @@ interface UiModule extends GeexModule {
|
|
|
74
91
|
activeRoutedComponent?: any;
|
|
75
92
|
}
|
|
76
93
|
type GeexModules<TExtensionModules extends Record<string, GeexModule> = {}> = {
|
|
94
|
+
init: () => Promise<any>;
|
|
77
95
|
tenant: TenantModule;
|
|
78
96
|
auth: AuthModule;
|
|
79
97
|
identity: IdentityModule;
|
|
@@ -81,11 +99,19 @@ type GeexModules<TExtensionModules extends Record<string, GeexModule> = {}> = {
|
|
|
81
99
|
settings: SettingsModule;
|
|
82
100
|
ui: UiModule;
|
|
83
101
|
} & TExtensionModules;
|
|
84
|
-
type GeexModule<TExtension = any> = {
|
|
102
|
+
type GeexModule<TExtension = any> = {
|
|
103
|
+
/**
|
|
104
|
+
* A module combines both reactive state (signals) and business logic methods.
|
|
105
|
+
* Concrete modules can extend this interface to expose their own signals & methods.
|
|
106
|
+
* This empty base exists mainly for typing convenience and future extension.
|
|
107
|
+
*/
|
|
108
|
+
init?: () => Promise<any>;
|
|
109
|
+
} & TExtension;
|
|
85
110
|
|
|
86
111
|
type GeexOverrides<TExtensionModules extends Record<string, GeexModule> = {}> = Partial<GeexModules<TExtensionModules>>;
|
|
87
112
|
declare let geex: GeexModules;
|
|
88
113
|
declare let Geex: InjectionToken<{
|
|
114
|
+
init: () => Promise<any>;
|
|
89
115
|
tenant: TenantModule;
|
|
90
116
|
auth: AuthModule;
|
|
91
117
|
identity: IdentityModule;
|
package/dist/index.js
CHANGED
|
@@ -48,10 +48,10 @@ var import_util = require("@delon/util");
|
|
|
48
48
|
var import_graphql_tag = __toESM(require("graphql-tag"));
|
|
49
49
|
var import_rxjs = require("rxjs");
|
|
50
50
|
var import_operators = require("rxjs/operators");
|
|
51
|
-
var GQL_CHECK_TENANT = import_graphql_tag.default`mutation checkTenant($code: String!) { checkTenant(code: $code) { code name } }`;
|
|
51
|
+
var GQL_CHECK_TENANT = import_graphql_tag.default`mutation checkTenant($code: String!) { checkTenant(code: $code) { id code name isEnabled createdOn } }`;
|
|
52
52
|
var GQL_FEDERATE_AUTH = import_graphql_tag.default`mutation federateAuthenticate($code: String!, $loginProvider: LoginProviderEnum!) { federateAuthenticate(code: $code, loginProvider: $loginProvider) { id orgs { code } } }`;
|
|
53
53
|
var GQL_ON_PUBLIC_NOTIFY = import_graphql_tag.default`subscription onPublicNotify { onPublicNotify { __typename ... on DataChangeClientNotify { dataChangeType } } }`;
|
|
54
|
-
var GQL_ORGS_CACHE = import_graphql_tag.default`query orgsCache { orgs { items { code name } } }`;
|
|
54
|
+
var GQL_ORGS_CACHE = import_graphql_tag.default`query orgsCache { orgs(take: 999) { items { id orgType code name parentOrgCode } } }`;
|
|
55
55
|
var GQL_INIT_SETTINGS = import_graphql_tag.default`query initSettings { initSettings { name value } }`;
|
|
56
56
|
function createTenantModule(injector) {
|
|
57
57
|
const current = (0, import_core.signal)(null);
|
|
@@ -174,6 +174,17 @@ var Geex = new import_core2.InjectionToken("Geex");
|
|
|
174
174
|
function configGeex(injector, overrides) {
|
|
175
175
|
(0, import_core2.runInInjectionContext)(injector, () => {
|
|
176
176
|
const modules = {
|
|
177
|
+
init: async () => {
|
|
178
|
+
const entries = Object.entries(modules).filter(([key]) => key !== "init");
|
|
179
|
+
await Promise.all(
|
|
180
|
+
entries.map(async ([, mod]) => {
|
|
181
|
+
const maybeInit = mod.init;
|
|
182
|
+
if (typeof maybeInit === "function") {
|
|
183
|
+
await maybeInit();
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
);
|
|
187
|
+
},
|
|
177
188
|
tenant: createTenantModule(injector),
|
|
178
189
|
auth: createAuthModule(injector),
|
|
179
190
|
identity: createIdentityModule(injector),
|
package/dist/index.mjs
CHANGED
|
@@ -11,10 +11,10 @@ import { CookieService, deepCopy } from "@delon/util";
|
|
|
11
11
|
import gql from "graphql-tag";
|
|
12
12
|
import { firstValueFrom, map, fromEvent } from "rxjs";
|
|
13
13
|
import { debounceTime, switchMap } from "rxjs/operators";
|
|
14
|
-
var GQL_CHECK_TENANT = gql`mutation checkTenant($code: String!) { checkTenant(code: $code) { code name } }`;
|
|
14
|
+
var GQL_CHECK_TENANT = gql`mutation checkTenant($code: String!) { checkTenant(code: $code) { id code name isEnabled createdOn } }`;
|
|
15
15
|
var GQL_FEDERATE_AUTH = gql`mutation federateAuthenticate($code: String!, $loginProvider: LoginProviderEnum!) { federateAuthenticate(code: $code, loginProvider: $loginProvider) { id orgs { code } } }`;
|
|
16
16
|
var GQL_ON_PUBLIC_NOTIFY = gql`subscription onPublicNotify { onPublicNotify { __typename ... on DataChangeClientNotify { dataChangeType } } }`;
|
|
17
|
-
var GQL_ORGS_CACHE = gql`query orgsCache { orgs { items { code name } } }`;
|
|
17
|
+
var GQL_ORGS_CACHE = gql`query orgsCache { orgs(take: 999) { items { id orgType code name parentOrgCode } } }`;
|
|
18
18
|
var GQL_INIT_SETTINGS = gql`query initSettings { initSettings { name value } }`;
|
|
19
19
|
function createTenantModule(injector) {
|
|
20
20
|
const current = signal(null);
|
|
@@ -137,6 +137,17 @@ var Geex = new InjectionToken("Geex");
|
|
|
137
137
|
function configGeex(injector, overrides) {
|
|
138
138
|
runInInjectionContext2(injector, () => {
|
|
139
139
|
const modules = {
|
|
140
|
+
init: async () => {
|
|
141
|
+
const entries = Object.entries(modules).filter(([key]) => key !== "init");
|
|
142
|
+
await Promise.all(
|
|
143
|
+
entries.map(async ([, mod]) => {
|
|
144
|
+
const maybeInit = mod.init;
|
|
145
|
+
if (typeof maybeInit === "function") {
|
|
146
|
+
await maybeInit();
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
);
|
|
150
|
+
},
|
|
140
151
|
tenant: createTenantModule(injector),
|
|
141
152
|
auth: createAuthModule(injector),
|
|
142
153
|
identity: createIdentityModule(injector),
|