@webiny/languages 0.0.0-unstable.a4f3e4ea8b → 0.0.0-unstable.d0f34a8194
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/Languages.js +3 -3
- package/Languages.js.map +1 -1
- package/admin/Extension.d.ts +1 -1
- package/admin/Extension.js +3 -1
- package/admin/Extension.js.map +1 -1
- package/api/Extension.js +2 -0
- package/api/Extension.js.map +1 -1
- package/api/graphql/LanguagesGraphQLSchema.d.ts +3 -2
- package/api/graphql/LanguagesGraphQLSchema.js +6 -2
- package/api/graphql/LanguagesGraphQLSchema.js.map +1 -1
- package/package.json +22 -20
package/Languages.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const Languages = ()=>/*#__PURE__*/ react.createElement(
|
|
2
|
+
import { Api } from "@webiny/project-aws/api.js";
|
|
3
|
+
import { Admin } from "@webiny/project-aws/admin.js";
|
|
4
|
+
const Languages = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
5
5
|
src: import.meta.dirname + "/api/Extension.js"
|
|
6
6
|
}), /*#__PURE__*/ react.createElement(Admin.Extension, {
|
|
7
7
|
src: import.meta.dirname + "/admin/Extension.js"
|
package/Languages.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Languages.js","sources":["../src/Languages.tsx"],"sourcesContent":["import React from \"react\";\nimport { Api
|
|
1
|
+
{"version":3,"file":"Languages.js","sources":["../src/Languages.tsx"],"sourcesContent":["import React from \"react\";\nimport { Api } from \"@webiny/project-aws/api.js\";\nimport { Admin } from \"@webiny/project-aws/admin.js\";\n\n/*\n * Not wrapped in a `FeatureFlag` component: those read the license when the project is built, so a\n * license that gained languages after the last deploy did nothing until the next one, while Website\n * Builder's checks already read the live license. Both extensions gate themselves on the\n * `languages` flag instead, the same way AI Powerups does.\n */\nexport const Languages = () => {\n return (\n <>\n {/* Api extensions */}\n <Api.Extension src={import.meta.dirname + \"/api/Extension.js\"} />\n\n {/* Admin extensions */}\n <Admin.Extension src={import.meta.dirname + \"/admin/Extension.js\"} />\n </>\n );\n};\n"],"names":["Languages","Api","Admin"],"mappings":";;;AAUO,MAAMA,YAAY,IACd,WAAP,GACI,wDAEI,oBAACC,IAAI,SAAS;QAAC,KAAK,YAAY,OAAO,GAAG;sBAG1C,oBAACC,MAAM,SAAS;QAAC,KAAK,YAAY,OAAO,GAAG"}
|
package/admin/Extension.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const Extension: () => React.JSX.Element;
|
|
2
|
+
export declare const Extension: () => React.JSX.Element | null;
|
package/admin/Extension.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
import { AdminConfig, HasPermission, RegisterFeature, useRouter } from "@webiny/app-admin";
|
|
2
|
+
import { AdminConfig, HasPermission, RegisterFeature, useFeatureFlags, useRouter } from "@webiny/app-admin";
|
|
3
3
|
import { Routes } from "@webiny/app-headless-cms";
|
|
4
4
|
import { LANGUAGE_MODEL_ID } from "../shared/constants.js";
|
|
5
5
|
import { SecurityPermission } from "./SecurityPermission.js";
|
|
@@ -8,6 +8,8 @@ import { ListLanguagesFeature } from "./features/listLanguages/index.js";
|
|
|
8
8
|
const { Menu: Menu } = AdminConfig;
|
|
9
9
|
const Extension = ()=>{
|
|
10
10
|
const { getLink } = useRouter();
|
|
11
|
+
const featureFlags = useFeatureFlags();
|
|
12
|
+
if (!featureFlags.isEnabled("languages")) return null;
|
|
11
13
|
const link = getLink(Routes.ContentEntries.List, {
|
|
12
14
|
modelId: LANGUAGE_MODEL_ID
|
|
13
15
|
});
|
package/admin/Extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/Extension.js","sources":["../../src/admin/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig
|
|
1
|
+
{"version":3,"file":"admin/Extension.js","sources":["../../src/admin/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { HasPermission } from \"@webiny/app-admin\";\nimport { RegisterFeature } from \"@webiny/app-admin\";\nimport { useFeatureFlags } from \"@webiny/app-admin\";\nimport { useRouter } from \"@webiny/app-admin\";\nimport { Routes } from \"@webiny/app-headless-cms\";\nimport { LANGUAGE_MODEL_ID } from \"~/shared/constants.js\";\nimport { SecurityPermission } from \"./SecurityPermission.js\";\nimport { LanguageEntryList } from \"~/admin/LanguageEntryList.js\";\nimport { ListLanguagesFeature } from \"./features/listLanguages/index.js\";\n\nconst { Menu } = AdminConfig;\n\nexport const Extension = () => {\n const { getLink } = useRouter();\n const featureFlags = useFeatureFlags();\n\n if (!featureFlags.isEnabled(\"languages\")) {\n return null;\n }\n\n const link = getLink(Routes.ContentEntries.List, { modelId: LANGUAGE_MODEL_ID });\n\n return (\n <>\n <RegisterFeature feature={ListLanguagesFeature} />\n <SecurityPermission />\n <AdminConfig>\n <HasPermission name={\"languages.*\"}>\n <Menu\n parent={\"settings.system\"}\n name=\"languages\"\n element={<Menu.Link text=\"Languages\" to={link} />}\n />\n </HasPermission>\n </AdminConfig>\n <LanguageEntryList />\n </>\n );\n};\n"],"names":["Menu","AdminConfig","Extension","getLink","useRouter","featureFlags","useFeatureFlags","link","Routes","LANGUAGE_MODEL_ID","RegisterFeature","ListLanguagesFeature","SecurityPermission","HasPermission","LanguageEntryList"],"mappings":";;;;;;;AAYA,MAAM,EAAEA,MAAAA,IAAI,EAAE,GAAGC;AAEV,MAAMC,YAAY;IACrB,MAAM,EAAEC,OAAO,EAAE,GAAGC;IACpB,MAAMC,eAAeC;IAErB,IAAI,CAACD,aAAa,SAAS,CAAC,cACxB,OAAO;IAGX,MAAME,OAAOJ,QAAQK,OAAO,cAAc,CAAC,IAAI,EAAE;QAAE,SAASC;IAAkB;IAE9E,OAAO,WAAP,GACI,wDACI,oBAACC,iBAAeA;QAAC,SAASC;sBAC1B,oBAACC,oBAAkBA,OAAAA,WAAAA,GACnB,oBAACX,aAAWA,MAAAA,WAAAA,GACR,oBAACY,eAAaA;QAAC,MAAM;qBACjB,oBAACb,MAAIA;QACD,QAAQ;QACR,MAAK;QACL,uBAAS,oBAACA,KAAK,IAAI;YAAC,MAAK;YAAY,IAAIO;;wBAIrD,oBAACO,mBAAiBA;AAG9B"}
|
package/api/Extension.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
|
|
2
3
|
import LanguageModel from "./domain/LanguageModel.js";
|
|
3
4
|
import { EnsureSingleDefaultLanguageFeature } from "./features/EnsureSingleDefaultLanguage/feature.js";
|
|
4
5
|
import { GetDefaultLanguageFeature } from "./features/GetDefaultLanguage/feature.js";
|
|
@@ -10,6 +11,7 @@ import { LanguagesPermissionsFeature } from "./features/Permissions/feature.js";
|
|
|
10
11
|
const Extension = createFeature({
|
|
11
12
|
name: "Languages",
|
|
12
13
|
register (container) {
|
|
14
|
+
if (!container.resolve(FeatureFlags).get().isEnabled("languages")) return;
|
|
13
15
|
container.register(LanguageModel);
|
|
14
16
|
EnsureSingleDefaultLanguageFeature.register(container);
|
|
15
17
|
GetDefaultLanguageFeature.register(container);
|
package/api/Extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/Extension.js","sources":["../../src/api/Extension.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport LanguageModel from \"./domain/LanguageModel.js\";\nimport { EnsureSingleDefaultLanguageFeature } from \"./features/EnsureSingleDefaultLanguage/feature.js\";\nimport { GetDefaultLanguageFeature } from \"./features/GetDefaultLanguage/feature.js\";\nimport { GetLanguageByCodeFeature } from \"./features/GetLanguageByCode/feature.js\";\nimport { ListLanguagesFeature } from \"./features/ListLanguages/feature.js\";\nimport { LanguagesGraphQLSchema } from \"./graphql/LanguagesGraphQLSchema.js\";\nimport { AddCmsPermissionsFeature } from \"~/api/features/AddCmsPermissions/feature.js\";\nimport { LanguagesPermissionsFeature } from \"~/api/features/Permissions/feature.js\";\n\nexport const Extension = createFeature({\n name: \"Languages\",\n register(container) {\n container.register(LanguageModel);\n\n // Features\n EnsureSingleDefaultLanguageFeature.register(container);\n GetDefaultLanguageFeature.register(container);\n GetLanguageByCodeFeature.register(container);\n ListLanguagesFeature.register(container);\n AddCmsPermissionsFeature.register(container);\n LanguagesPermissionsFeature.register(container);\n\n // GraphQL\n container.register(LanguagesGraphQLSchema);\n }\n});\n"],"names":["Extension","createFeature","container","LanguageModel","EnsureSingleDefaultLanguageFeature","GetDefaultLanguageFeature","GetLanguageByCodeFeature","ListLanguagesFeature","AddCmsPermissionsFeature","LanguagesPermissionsFeature","LanguagesGraphQLSchema"],"mappings":"
|
|
1
|
+
{"version":3,"file":"api/Extension.js","sources":["../../src/api/Extension.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport LanguageModel from \"./domain/LanguageModel.js\";\nimport { EnsureSingleDefaultLanguageFeature } from \"./features/EnsureSingleDefaultLanguage/feature.js\";\nimport { GetDefaultLanguageFeature } from \"./features/GetDefaultLanguage/feature.js\";\nimport { GetLanguageByCodeFeature } from \"./features/GetLanguageByCode/feature.js\";\nimport { ListLanguagesFeature } from \"./features/ListLanguages/feature.js\";\nimport { LanguagesGraphQLSchema } from \"./graphql/LanguagesGraphQLSchema.js\";\nimport { AddCmsPermissionsFeature } from \"~/api/features/AddCmsPermissions/feature.js\";\nimport { LanguagesPermissionsFeature } from \"~/api/features/Permissions/feature.js\";\n\nexport const Extension = createFeature({\n name: \"Languages\",\n register(container) {\n /*\n * Register-time gate on the effective feature flags (project config && live WCP license).\n * Nothing is registered when languages are off, so the model and its GraphQL schema do not\n * exist for that project.\n */\n if (!container.resolve(FeatureFlags).get().isEnabled(\"languages\")) {\n return;\n }\n\n container.register(LanguageModel);\n\n // Features\n EnsureSingleDefaultLanguageFeature.register(container);\n GetDefaultLanguageFeature.register(container);\n GetLanguageByCodeFeature.register(container);\n ListLanguagesFeature.register(container);\n AddCmsPermissionsFeature.register(container);\n LanguagesPermissionsFeature.register(container);\n\n // GraphQL\n container.register(LanguagesGraphQLSchema);\n }\n});\n"],"names":["Extension","createFeature","container","FeatureFlags","LanguageModel","EnsureSingleDefaultLanguageFeature","GetDefaultLanguageFeature","GetLanguageByCodeFeature","ListLanguagesFeature","AddCmsPermissionsFeature","LanguagesPermissionsFeature","LanguagesGraphQLSchema"],"mappings":";;;;;;;;;;AAWO,MAAMA,YAAYC,cAAc;IACnC,MAAM;IACN,UAASC,SAAS;QAMd,IAAI,CAACA,UAAU,OAAO,CAACC,cAAc,GAAG,GAAG,SAAS,CAAC,cACjD;QAGJD,UAAU,QAAQ,CAACE;QAGnBC,mCAAmC,QAAQ,CAACH;QAC5CI,0BAA0B,QAAQ,CAACJ;QACnCK,yBAAyB,QAAQ,CAACL;QAClCM,qBAAqB,QAAQ,CAACN;QAC9BO,yBAAyB,QAAQ,CAACP;QAClCQ,4BAA4B,QAAQ,CAACR;QAGrCA,UAAU,QAAQ,CAACS;IACvB;AACJ"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { CoreGraphQLSchemaFactory } from "@webiny/
|
|
1
|
+
import { CoreGraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.core.js";
|
|
2
2
|
declare class LanguagesGraphQLSchemaImpl implements CoreGraphQLSchemaFactory.Interface {
|
|
3
|
+
getSchemaKey: () => string;
|
|
3
4
|
execute(builder: CoreGraphQLSchemaFactory.SchemaBuilder): Promise<CoreGraphQLSchemaFactory.SchemaBuilder>;
|
|
4
5
|
}
|
|
5
6
|
export declare const LanguagesGraphQLSchema: typeof LanguagesGraphQLSchemaImpl & {
|
|
6
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/
|
|
7
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-graphql/graphql/abstractions.core.js").ICoreGraphQLSchemaFactory>;
|
|
7
8
|
};
|
|
8
9
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ErrorResponse, Response } from "@webiny/
|
|
1
|
+
import { ErrorResponse, Response } from "@webiny/api-graphql";
|
|
2
|
+
import { staticSchemaKey } from "@webiny/api-graphql/graphql/staticSchemaKey.js";
|
|
2
3
|
import { ListLanguagesUseCase } from "../features/ListLanguages/index.js";
|
|
3
|
-
import { CoreGraphQLSchemaFactory } from "@webiny/
|
|
4
|
+
import { CoreGraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.core.js";
|
|
4
5
|
class LanguagesGraphQLSchemaImpl {
|
|
5
6
|
async execute(builder) {
|
|
6
7
|
builder.addTypeDefs(`
|
|
@@ -49,6 +50,9 @@ class LanguagesGraphQLSchemaImpl {
|
|
|
49
50
|
});
|
|
50
51
|
return builder;
|
|
51
52
|
}
|
|
53
|
+
constructor(){
|
|
54
|
+
this.getSchemaKey = staticSchemaKey("languages/LanguagesGraphQLSchemaImpl");
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
const LanguagesGraphQLSchema = CoreGraphQLSchemaFactory.createImplementation({
|
|
54
58
|
implementation: LanguagesGraphQLSchemaImpl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/graphql/LanguagesGraphQLSchema.js","sources":["../../../src/api/graphql/LanguagesGraphQLSchema.ts"],"sourcesContent":["import { Response, ErrorResponse } from \"@webiny/
|
|
1
|
+
{"version":3,"file":"api/graphql/LanguagesGraphQLSchema.js","sources":["../../../src/api/graphql/LanguagesGraphQLSchema.ts"],"sourcesContent":["import { Response, ErrorResponse } from \"@webiny/api-graphql\";\nimport { staticSchemaKey } from \"@webiny/api-graphql/graphql/staticSchemaKey.js\";\nimport { ListLanguagesUseCase } from \"~/api/features/ListLanguages/index.js\";\nimport { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.core.js\";\n\nclass LanguagesGraphQLSchemaImpl implements CoreGraphQLSchemaFactory.Interface {\n public getSchemaKey = staticSchemaKey(\"languages/LanguagesGraphQLSchemaImpl\");\n\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): Promise<CoreGraphQLSchemaFactory.SchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type LanguagesQuery {\n listLanguages: LanguagesListResponse!\n }\n\n type Language {\n id: ID!\n code: String!\n name: String!\n direction: String\n isDefault: Boolean\n enabled: Boolean\n }\n\n type LanguagesListResponse {\n data: [Language!]\n error: LanguagesError\n }\n\n type LanguagesError {\n code: String!\n message: String!\n data: JSON\n }\n\n extend type Query {\n languages: LanguagesQuery\n }\n `);\n\n // Namespace resolver\n builder.addResolver({\n path: \"Query.languages\",\n resolver: () => {\n return () => ({});\n }\n });\n\n // List languages resolver\n builder.addResolver({\n path: \"LanguagesQuery.listLanguages\",\n dependencies: [ListLanguagesUseCase],\n resolver: (listLanguages: ListLanguagesUseCase.Interface) => {\n return async () => {\n const result = await listLanguages.execute();\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new Response(result.value);\n };\n }\n });\n\n return builder;\n }\n}\n\nexport const LanguagesGraphQLSchema = CoreGraphQLSchemaFactory.createImplementation({\n implementation: LanguagesGraphQLSchemaImpl,\n dependencies: []\n});\n"],"names":["LanguagesGraphQLSchemaImpl","builder","ListLanguagesUseCase","listLanguages","result","ErrorResponse","Response","staticSchemaKey","LanguagesGraphQLSchema","CoreGraphQLSchemaFactory"],"mappings":";;;;AAKA,MAAMA;IAGF,MAAM,QACFC,OAA+C,EACA;QAC/CA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4BnC,CAAC;QAGDA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,UAAU,IACC,IAAO,EAAC;QAEvB;QAGAA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc;gBAACC;aAAqB;YACpC,UAAU,CAACC,gBACA;oBACH,MAAMC,SAAS,MAAMD,cAAc,OAAO;oBAE1C,IAAIC,OAAO,MAAM,IACb,OAAO,IAAIC,cAAcD,OAAO,KAAK;oBAGzC,OAAO,IAAIE,SAASF,OAAO,KAAK;gBACpC;QAER;QAEA,OAAOH;IACX;;aA7DO,YAAY,GAAGM,gBAAgB;;AA8D1C;AAEO,MAAMC,yBAAyBC,yBAAyB,oBAAoB,CAAC;IAChF,gBAAgBT;IAChB,cAAc,EAAE;AACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/languages",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.d0f34a8194",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -15,31 +15,33 @@
|
|
|
15
15
|
"author": "Webiny Ltd.",
|
|
16
16
|
"license": "Webiny Enterprise",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@webiny/admin-ui": "0.0.0-unstable.
|
|
19
|
-
"@webiny/api": "0.0.0-unstable.
|
|
20
|
-
"@webiny/api-
|
|
21
|
-
"@webiny/
|
|
22
|
-
"@webiny/app": "0.0.0-unstable.
|
|
23
|
-
"@webiny/app-
|
|
24
|
-
"@webiny/
|
|
25
|
-
"@webiny/
|
|
26
|
-
"@webiny/
|
|
27
|
-
"@webiny/
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"mobx": "6.16.1",
|
|
18
|
+
"@webiny/admin-ui": "0.0.0-unstable.d0f34a8194",
|
|
19
|
+
"@webiny/api-core": "0.0.0-unstable.d0f34a8194",
|
|
20
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.d0f34a8194",
|
|
21
|
+
"@webiny/app": "0.0.0-unstable.d0f34a8194",
|
|
22
|
+
"@webiny/app-admin": "0.0.0-unstable.d0f34a8194",
|
|
23
|
+
"@webiny/app-headless-cms": "0.0.0-unstable.d0f34a8194",
|
|
24
|
+
"@webiny/feature": "0.0.0-unstable.d0f34a8194",
|
|
25
|
+
"@webiny/icons": "0.0.0-unstable.d0f34a8194",
|
|
26
|
+
"@webiny/project": "0.0.0-unstable.d0f34a8194",
|
|
27
|
+
"@webiny/project-aws": "0.0.0-unstable.d0f34a8194",
|
|
28
|
+
"graphql": "16.14.2",
|
|
29
|
+
"mobx": "7.0.3",
|
|
31
30
|
"react": "18.3.1",
|
|
32
31
|
"react-dom": "18.3.1"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
|
-
"@webiny/
|
|
36
|
-
"@webiny/
|
|
37
|
-
"@webiny/
|
|
38
|
-
"@webiny/
|
|
39
|
-
"@webiny/
|
|
34
|
+
"@webiny/api-core-testing": "0.0.0-unstable.d0f34a8194",
|
|
35
|
+
"@webiny/api-graphql": "0.0.0-unstable.d0f34a8194",
|
|
36
|
+
"@webiny/build-tools": "0.0.0-unstable.d0f34a8194",
|
|
37
|
+
"@webiny/db-dynamodb": "0.0.0-unstable.d0f34a8194",
|
|
38
|
+
"@webiny/di": "2.0.0",
|
|
39
|
+
"@webiny/event-handler-core": "0.0.0-unstable.d0f34a8194",
|
|
40
|
+
"@webiny/handler": "0.0.0-unstable.d0f34a8194",
|
|
41
|
+
"@webiny/wcp": "0.0.0-unstable.d0f34a8194",
|
|
40
42
|
"rimraf": "6.1.3",
|
|
41
43
|
"typescript": "7.0.2",
|
|
42
|
-
"vitest": "4.1.
|
|
44
|
+
"vitest": "4.1.11"
|
|
43
45
|
},
|
|
44
46
|
"publishConfig": {
|
|
45
47
|
"access": "public"
|