@teambit/deprecation 0.0.601 → 0.0.603

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["deprecation.main.runtime.ts"],"names":["DeprecationMain","constructor","scope","workspace","getDeprecationInfo","component","data","config","extensions","findExtension","DeprecationAspect","id","deprecatedBackwardCompatibility","state","_consumer","deprecated","isDeprecate","Boolean","deprecate","newId","ComponentID","fromObject","toString","undefined","componentId","results","bitMap","addComponentConfig","toObject","write","unDeprecate","provider","graphql","componentAspect","cli","deprecation","register","DeprecateCmd","UndeprecateCmd","registerShowFragments","DeprecationFragment","MainRuntime","GraphqlAspect","ScopeAspect","ComponentAspect","WorkspaceAspect","CLIAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAYO,MAAMA,eAAN,CAAsB;AAC3BC,EAAAA,WAAW,CAASC,KAAT,EAAmCC,SAAnC,EAAyD;AAAA,SAAhDD,KAAgD,GAAhDA,KAAgD;AAAA,SAAtBC,SAAsB,GAAtBA,SAAsB;AAAE;;AAI9C,QAAlBC,kBAAkB,CAACC,SAAD,EAAiD;AAAA;;AACvE,UAAMC,IAAI,4BAAGD,SAAS,CAACE,MAAV,CA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hB;AAIA,UAAM,KAAKhB,SAAL,CAAeuB,MAAf,CAAsBG,KAAtB,EAAN;AAEA,WAAOJ,OAAP;AACD;;AAEoB,eAARM,QAAQ,CAAC,CAACC,OAAD,EAAU9B,KAAV,EAAiB+B,eAAjB,EAAkC9B,SAAlC,EAA6C+B,GAA7C,CAAD,EAMlB;AACD,UAAMC,WAAW,GAAG,IAAInC,eAAJ,CAAoBE,KAApB,EAA2BC,SAA3B,CAApB;AACA+B,IAAAA,GAAG,CAACE,QAAJ,CAAa,KAAIC,4BAAJ,EAAiBF,WAAjB,EAA8BhC,SAA9B,CAAb,EAAuD,KAAImC,gCAAJ,EAAmBH,WAAnB,EAAgChC,SAAhC,CAAvD;AACA8B,IAAAA,eAAe,CAACM,qBAAhB,CAAsC,CAAC,KAAIC,mCAAJ,EAAwBL,WAAxB,CAAD,CAAtC;AACAH,IAAAA,OAAO,CAACI,QAAR,CAAiB,uCAAkBD,WAAlB,CAAjB;AAEA,WAAOA,WAAP;AACD;;AA3D0B;;;gCAAhBnC,e,aAEMyC,kB;gCAFNzC,e,kBAGW,CAAC0C,wBAAD,EAAgBC,oBAAhB,EAA6BC,4BAA7B,EAA8CC,oBAA9C,EAA+DC,gBAA/D,C;;AA2DxBpC,iCAAkBqC,UAAlB,CAA6B/C,eAA7B","sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { ComponentMain, ComponentAspect, Component, ComponentID } from '@teambit/component';\nimport { ScopeMain, ScopeAspect } from '@teambit/scope';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { ComponentIdObj } from '@teambit/component-id';\nimport { DeprecationAspect } from './deprecation.aspect';\nimport { deprecationSchema } from './deprecation.graphql';\nimport { DeprecationFragment } from './deprecation.fragment';\nimport { DeprecateCmd } from './deprecate-cmd';\nimport { UndeprecateCmd } from './undeprecate-cmd';\n\nexport type DeprecationInfo = {\n isDeprecate: boolean;\n newId?: string;\n};\n\nexport type DeprecationMetadata = {\n deprecate?: boolean;\n newId?: ComponentIdObj;\n};\n\nexport class DeprecationMain {\n constructor(private scope: ScopeMain, private workspace: Workspace) {}\n static runtime = MainRuntime;\n static dependencies = [GraphqlAspect, ScopeAspect, ComponentAspect, WorkspaceAspect, CLIAspect];\n\n async getDeprecationInfo(component: Component): Promise<DeprecationInfo> {\n const data = component.config.extensions.findExtension(DeprecationAspect.id)?.config as\n | DeprecationMetadata\n | undefined;\n const deprecatedBackwardCompatibility = component.state._consumer.deprecated;\n const isDeprecate = Boolean(data?.deprecate || deprecatedBackwardCompatibility);\n const newId = data?.newId ? ComponentID.fromObject(data?.newId).toString() : undefined;\n return {\n isDeprecate,\n newId,\n };\n }\n\n /**\n * mark a component as deprecated. after this change, the component will be modified.\n * tag and export the component to have it deprecated on the remote.\n *\n * @param componentId\n * @param newId\n * @returns boolean whether or not the component has been deprecated\n */\n async deprecate(componentId: ComponentID, newId?: ComponentID): Promise<boolean> {\n const results = this.workspace.bitMap.addComponentConfig(componentId, DeprecationAspect.id, {\n deprecate: true,\n newId: newId?.toObject(),\n });\n await this.workspace.bitMap.write();\n\n return results;\n }\n\n async unDeprecate(componentId: ComponentID) {\n const results = this.workspace.bitMap.addComponentConfig(componentId, DeprecationAspect.id, {\n deprecate: false,\n newId: '',\n });\n await this.workspace.bitMap.write();\n\n return results;\n }\n\n static async provider([graphql, scope, componentAspect, workspace, cli]: [\n GraphqlMain,\n ScopeMain,\n ComponentMain,\n Workspace,\n CLIMain\n ]) {\n const deprecation = new DeprecationMain(scope, workspace);\n cli.register(new DeprecateCmd(deprecation, workspace), new UndeprecateCmd(deprecation, workspace));\n componentAspect.registerShowFragments([new DeprecationFragment(deprecation)]);\n graphql.register(deprecationSchema(deprecation));\n\n return deprecation;\n }\n}\n\nDeprecationAspect.addRuntime(DeprecationMain);"]}
1
+ {"version":3,"sources":["deprecation.main.runtime.ts"],"names":["DeprecationMain","constructor","scope","workspace","getDeprecationInfo","component","data","config","extensions","findExtension","DeprecationAspect","id","deprecatedBackwardCompatibility","state","_consumer","deprecated","isDeprecate","Boolean","deprecate","newId","ComponentID","fromObject","toString","undefined","componentId","results","bitMap","addComponentConfig","toObject","write","unDeprecate","provider","graphql","componentAspect","cli","deprecation","register","DeprecateCmd","UndeprecateCmd","registerShowFragments","DeprecationFragment","MainRuntime","GraphqlAspect","ScopeAspect","ComponentAspect","WorkspaceAspect","CLIAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAYO,MAAMA,eAAN,CAAsB;AAC3BC,EAAAA,WAAW,CAASC,KAAT,EAAmCC,SAAnC,EAAyD;AAAA,SAAhDD,KAAgD,GAAhDA,KAAgD;AAAA,SAAtBC,SAAsB,GAAtBA,SAAsB;AAAE;;AAI9C,QAAlBC,kBAAkB,CAACC,SAAD,EAAiD;AAAA;;AACvE,UAAMC,IAAI,4BAAGD,SAAS,CAACE,MAAV,CAAiBC,UAAjB,CAA4BC,aAA5B,CAA0CC,iCAAkBC,EAA5D,CAAH,0DAAG,sBAAiEJ,MAA9E;AAGA,UAAMK,+BAA+B,GAAGP,SAAS,CAACQ,KAAV,CAAgBC,SAAhB,CAA0BC,UAAlE;AACA,UAAMC,WAAW,GAAGC,OAAO,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CAAD,EAMlB;AACD,UAAMC,WAAW,GAAG,IAAInC,eAAJ,CAAoBE,KAApB,EAA2BC,SAA3B,CAApB;AACA+B,IAAAA,GAAG,CAACE,QAAJ,CAAa,KAAIC,4BAAJ,EAAiBF,WAAjB,EAA8BhC,SAA9B,CAAb,EAAuD,KAAImC,gCAAJ,EAAmBH,WAAnB,EAAgChC,SAAhC,CAAvD;AACA8B,IAAAA,eAAe,CAACM,qBAAhB,CAAsC,CAAC,KAAIC,mCAAJ,EAAwBL,WAAxB,CAAD,CAAtC;AACAH,IAAAA,OAAO,CAACI,QAAR,CAAiB,uCAAkBD,WAAlB,CAAjB;AAEA,WAAOA,WAAP;AACD;;AA3D0B;;;gCAAhBnC,e,aAEMyC,kB;gCAFNzC,e,kBAGW,CAAC0C,wBAAD,EAAgBC,oBAAhB,EAA6BC,4BAA7B,EAA8CC,oBAA9C,EAA+DC,gBAA/D,C;;AA2DxBpC,iCAAkBqC,UAAlB,CAA6B/C,eAA7B","sourcesContent":["import { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { ComponentMain, ComponentAspect, Component, ComponentID } from '@teambit/component';\nimport { ScopeMain, ScopeAspect } from '@teambit/scope';\nimport WorkspaceAspect, { Workspace } from '@teambit/workspace';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { ComponentIdObj } from '@teambit/component-id';\nimport { DeprecationAspect } from './deprecation.aspect';\nimport { deprecationSchema } from './deprecation.graphql';\nimport { DeprecationFragment } from './deprecation.fragment';\nimport { DeprecateCmd } from './deprecate-cmd';\nimport { UndeprecateCmd } from './undeprecate-cmd';\n\nexport type DeprecationInfo = {\n isDeprecate: boolean;\n newId?: string;\n};\n\nexport type DeprecationMetadata = {\n deprecate?: boolean;\n newId?: ComponentIdObj;\n};\n\nexport class DeprecationMain {\n constructor(private scope: ScopeMain, private workspace: Workspace) {}\n static runtime = MainRuntime;\n static dependencies = [GraphqlAspect, ScopeAspect, ComponentAspect, WorkspaceAspect, CLIAspect];\n\n async getDeprecationInfo(component: Component): Promise<DeprecationInfo> {\n const data = component.config.extensions.findExtension(DeprecationAspect.id)?.config as\n | DeprecationMetadata\n | undefined;\n const deprecatedBackwardCompatibility = component.state._consumer.deprecated;\n const isDeprecate = Boolean(data?.deprecate || deprecatedBackwardCompatibility);\n const newId = data?.newId ? ComponentID.fromObject(data?.newId).toString() : undefined;\n return {\n isDeprecate,\n newId,\n };\n }\n\n /**\n * mark a component as deprecated. after this change, the component will be modified.\n * tag and export the component to have it deprecated on the remote.\n *\n * @param componentId\n * @param newId\n * @returns boolean whether or not the component has been deprecated\n */\n async deprecate(componentId: ComponentID, newId?: ComponentID): Promise<boolean> {\n const results = this.workspace.bitMap.addComponentConfig(componentId, DeprecationAspect.id, {\n deprecate: true,\n newId: newId?.toObject(),\n });\n await this.workspace.bitMap.write();\n\n return results;\n }\n\n async unDeprecate(componentId: ComponentID) {\n const results = this.workspace.bitMap.addComponentConfig(componentId, DeprecationAspect.id, {\n deprecate: false,\n newId: '',\n });\n await this.workspace.bitMap.write();\n\n return results;\n }\n\n static async provider([graphql, scope, componentAspect, workspace, cli]: [\n GraphqlMain,\n ScopeMain,\n ComponentMain,\n Workspace,\n CLIMain\n ]) {\n const deprecation = new DeprecationMain(scope, workspace);\n cli.register(new DeprecateCmd(deprecation, workspace), new UndeprecateCmd(deprecation, workspace));\n componentAspect.registerShowFragments([new DeprecationFragment(deprecation)]);\n graphql.register(deprecationSchema(deprecation));\n\n return deprecation;\n }\n}\n\nDeprecationAspect.addRuntime(DeprecationMain);\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/deprecation",
3
- "version": "0.0.601",
3
+ "version": "0.0.603",
4
4
  "homepage": "https://bit.dev/teambit/component/deprecation",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "deprecation",
9
- "version": "0.0.601"
9
+ "version": "0.0.603"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -14,12 +14,12 @@
14
14
  "graphql-tag": "2.12.1",
15
15
  "@babel/runtime": "7.12.18",
16
16
  "core-js": "^3.0.0",
17
- "@teambit/cli": "0.0.413",
18
- "@teambit/workspace": "0.0.601",
19
- "@teambit/component": "0.0.601",
20
- "@teambit/graphql": "0.0.601",
17
+ "@teambit/cli": "0.0.415",
18
+ "@teambit/workspace": "0.0.603",
19
+ "@teambit/component": "0.0.603",
20
+ "@teambit/graphql": "0.0.603",
21
21
  "@teambit/component-id": "0.0.398",
22
- "@teambit/scope": "0.0.601"
22
+ "@teambit/scope": "0.0.603"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/mocha": "5.2.7",