@xxmachina/common 19.133.0 → 19.140.2
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.
|
@@ -6,10 +6,12 @@ class QuickJsService {
|
|
|
6
6
|
quickJs = signal(null, ...(ngDevMode ? [{ debugName: "quickJs" }] : []));
|
|
7
7
|
quickJs$ = toObservable(this.quickJs);
|
|
8
8
|
initialized = computed(() => !!this.quickJs(), ...(ngDevMode ? [{ debugName: "initialized" }] : []));
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
loading = null;
|
|
10
|
+
loadQuickJs() {
|
|
11
|
+
this.loading ??= this.doLoadQuickJs();
|
|
12
|
+
return this.loading;
|
|
11
13
|
}
|
|
12
|
-
async
|
|
14
|
+
async doLoadQuickJs() {
|
|
13
15
|
if (this.quickJs())
|
|
14
16
|
return this.quickJs();
|
|
15
17
|
// @ts-ignore
|
|
@@ -55,7 +57,7 @@ class QuickJsService {
|
|
|
55
57
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: QuickJsService, decorators: [{
|
|
56
58
|
type: Injectable,
|
|
57
59
|
args: [{ providedIn: 'root' }]
|
|
58
|
-
}]
|
|
60
|
+
}] });
|
|
59
61
|
|
|
60
62
|
/**
|
|
61
63
|
* Generated bundle index. Do not edit.
|
|
@@ -2,14 +2,18 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { inject, Injectable } from '@angular/core';
|
|
3
3
|
import { QuickJsService } from '@xxmachina/common/infra/external/quick-js';
|
|
4
4
|
|
|
5
|
+
const IDENTITY_TRANSFORMER_RE = /^const transformer = \((\w+)\) => \1;?$/;
|
|
6
|
+
function isIdentityTransformerTs(transformerTs) {
|
|
7
|
+
return IDENTITY_TRANSFORMER_RE.test(transformerTs.trim());
|
|
8
|
+
}
|
|
5
9
|
class TransformerService {
|
|
6
10
|
quickJs = inject(QuickJsService);
|
|
7
11
|
transform({ transformerTs, transformer = (result) => result, }, input) {
|
|
8
|
-
if (transformerTs) {
|
|
12
|
+
if (transformerTs && !isIdentityTransformerTs(transformerTs)) {
|
|
9
13
|
const typescript = transformerTs;
|
|
10
14
|
return this.quickJs.apply(typescript, 'transformer', [input]);
|
|
11
15
|
}
|
|
12
|
-
return transformer(input);
|
|
16
|
+
return typeof transformer === 'function' ? transformer(input) : input;
|
|
13
17
|
}
|
|
14
18
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: TransformerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
15
19
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: TransformerService, providedIn: 'root' });
|
|
@@ -23,4 +27,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImpor
|
|
|
23
27
|
* Generated bundle index. Do not edit.
|
|
24
28
|
*/
|
|
25
29
|
|
|
26
|
-
export { TransformerService };
|
|
30
|
+
export { TransformerService, isIdentityTransformerTs };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xxmachina/common",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.140.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"@nestjs/common": "10.2.8",
|
|
14
14
|
"@nestjs/graphql": "^11.0.0",
|
|
15
15
|
"@nestjs/passport": "^9.0.3",
|
|
16
|
-
"@ng-atomic/common": "19.
|
|
17
|
-
"@ng-atomic/components": "19.
|
|
18
|
-
"@ng-atomic/core": "19.
|
|
19
|
-
"@nx-ddd/common": "19.
|
|
20
|
-
"@nx-ddd/core": "19.
|
|
16
|
+
"@ng-atomic/common": "19.140.2",
|
|
17
|
+
"@ng-atomic/components": "19.140.2",
|
|
18
|
+
"@ng-atomic/core": "19.140.2",
|
|
19
|
+
"@nx-ddd/common": "19.140.2",
|
|
20
|
+
"@nx-ddd/core": "19.140.2",
|
|
21
21
|
"@tfarras/nestjs-firebase-auth": "^2.0.0",
|
|
22
22
|
"apollo-angular": "^7.0.2",
|
|
23
23
|
"class-transformer": "^0.5.1",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"validate-azure-ad-token": "^2.2.0"
|
|
44
44
|
},
|
|
45
45
|
"optionalDependencies": {
|
|
46
|
-
"@nx-ddd/any-func": "19.
|
|
47
|
-
"@nx-ddd/firestore": "19.
|
|
48
|
-
"@nx-ddd/google": "19.
|
|
49
|
-
"@nx-ddd/hasura": "19.
|
|
50
|
-
"@nx-ddd/notion": "19.
|
|
46
|
+
"@nx-ddd/any-func": "19.140.2",
|
|
47
|
+
"@nx-ddd/firestore": "19.140.2",
|
|
48
|
+
"@nx-ddd/google": "19.140.2",
|
|
49
|
+
"@nx-ddd/hasura": "19.140.2",
|
|
50
|
+
"@nx-ddd/notion": "19.140.2",
|
|
51
51
|
"@notionhq/client": "^2.2.15"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
@@ -8,8 +8,9 @@ declare class QuickJsService {
|
|
|
8
8
|
private readonly quickJs;
|
|
9
9
|
protected readonly quickJs$: Observable<QuickJs>;
|
|
10
10
|
readonly initialized: i0.Signal<boolean>;
|
|
11
|
-
|
|
11
|
+
private loading;
|
|
12
12
|
protected loadQuickJs(): Promise<QuickJs>;
|
|
13
|
+
private doLoadQuickJs;
|
|
13
14
|
execute(script: string): Promise<unknown>;
|
|
14
15
|
apply(script: string, functionName: any, args?: any[]): Promise<unknown>;
|
|
15
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<QuickJsService, never>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QuickJsService } from '@xxmachina/common/infra/external/quick-js';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
|
|
4
|
+
declare function isIdentityTransformerTs(transformerTs: string): boolean;
|
|
4
5
|
declare class TransformerService {
|
|
5
6
|
readonly quickJs: QuickJsService;
|
|
6
7
|
transform({ transformerTs, transformer, }: {
|
|
@@ -11,4 +12,4 @@ declare class TransformerService {
|
|
|
11
12
|
static ɵprov: i0.ɵɵInjectableDeclaration<TransformerService>;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
export { TransformerService };
|
|
15
|
+
export { TransformerService, isIdentityTransformerTs };
|