@microwiseai/snapshot 0.3.5 → 0.3.26
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/commands/install.d.ts +13 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +621 -98
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/license.d.ts +21 -0
- package/dist/commands/license.d.ts.map +1 -0
- package/dist/commands/license.js +120 -0
- package/dist/commands/license.js.map +1 -0
- package/dist/index.js +46 -6
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +32 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +89 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/gitlab.d.ts +26 -20
- package/dist/lib/gitlab.d.ts.map +1 -1
- package/dist/lib/gitlab.js +100 -153
- package/dist/lib/gitlab.js.map +1 -1
- package/dist/lib/package-resolver.d.ts +48 -0
- package/dist/lib/package-resolver.d.ts.map +1 -0
- package/dist/lib/package-resolver.js +178 -0
- package/dist/lib/package-resolver.js.map +1 -0
- package/dist/lib/skit-adapter.d.ts +56 -0
- package/dist/lib/skit-adapter.d.ts.map +1 -0
- package/dist/lib/skit-adapter.js +166 -0
- package/dist/lib/skit-adapter.js.map +1 -0
- package/dist/lib/transitive-resolver.d.ts +86 -0
- package/dist/lib/transitive-resolver.d.ts.map +1 -0
- package/dist/lib/transitive-resolver.js +431 -0
- package/dist/lib/transitive-resolver.js.map +1 -0
- package/dist/lib/types.d.ts +13 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib.d.ts +59 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +134 -0
- package/dist/lib.js.map +1 -0
- package/dist/tools/snapshot-to-license.d.ts +13 -0
- package/dist/tools/snapshot-to-license.d.ts.map +1 -0
- package/dist/tools/snapshot-to-license.js +105 -0
- package/dist/tools/snapshot-to-license.js.map +1 -0
- package/node_modules/@microwiseai/cache/README.md +143 -0
- package/node_modules/@microwiseai/cache/dist/file.d.ts +97 -0
- package/node_modules/@microwiseai/cache/dist/file.d.ts.map +1 -0
- package/node_modules/@microwiseai/cache/dist/file.js +256 -0
- package/node_modules/@microwiseai/cache/dist/file.js.map +1 -0
- package/node_modules/@microwiseai/cache/dist/index.d.ts +10 -0
- package/node_modules/@microwiseai/cache/dist/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/cache/dist/index.js +11 -0
- package/node_modules/@microwiseai/cache/dist/index.js.map +1 -0
- package/node_modules/@microwiseai/cache/dist/memory.d.ts +69 -0
- package/node_modules/@microwiseai/cache/dist/memory.d.ts.map +1 -0
- package/node_modules/@microwiseai/cache/dist/memory.js +152 -0
- package/node_modules/@microwiseai/cache/dist/memory.js.map +1 -0
- package/node_modules/@microwiseai/cache/dist/types.d.ts +76 -0
- package/node_modules/@microwiseai/cache/dist/types.d.ts.map +1 -0
- package/node_modules/@microwiseai/cache/dist/types.js +5 -0
- package/node_modules/@microwiseai/cache/dist/types.js.map +1 -0
- package/node_modules/@microwiseai/cache/package.json +40 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/detector.test.d.ts +7 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/detector.test.d.ts.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/detector.test.js +139 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/detector.test.js.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/reporter.test.d.ts +8 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/reporter.test.d.ts.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/reporter.test.js +195 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/reporter.test.js.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/types.test.d.ts +8 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/types.test.d.ts.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/types.test.js +97 -0
- package/node_modules/@microwiseai/import-telemetry/dist/__tests__/types.test.js.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/detector.d.ts +16 -0
- package/node_modules/@microwiseai/import-telemetry/dist/detector.d.ts.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/detector.js +103 -0
- package/node_modules/@microwiseai/import-telemetry/dist/detector.js.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/index.d.ts +48 -0
- package/node_modules/@microwiseai/import-telemetry/dist/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/index.js +56 -0
- package/node_modules/@microwiseai/import-telemetry/dist/index.js.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/reporter.d.ts +16 -0
- package/node_modules/@microwiseai/import-telemetry/dist/reporter.d.ts.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/reporter.js +147 -0
- package/node_modules/@microwiseai/import-telemetry/dist/reporter.js.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/types.d.ts +75 -0
- package/node_modules/@microwiseai/import-telemetry/dist/types.d.ts.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/dist/types.js +23 -0
- package/node_modules/@microwiseai/import-telemetry/dist/types.js.map +1 -0
- package/node_modules/@microwiseai/import-telemetry/package.json +40 -0
- package/node_modules/@microwiseai/license/README.md +157 -0
- package/node_modules/@microwiseai/license/dist/api/client.d.ts +37 -0
- package/node_modules/@microwiseai/license/dist/api/client.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/api/client.js +95 -0
- package/node_modules/@microwiseai/license/dist/api/client.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/api/endpoints.d.ts +25 -0
- package/node_modules/@microwiseai/license/dist/api/endpoints.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/api/endpoints.js +101 -0
- package/node_modules/@microwiseai/license/dist/api/endpoints.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/api/index.d.ts +7 -0
- package/node_modules/@microwiseai/license/dist/api/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/api/index.js +8 -0
- package/node_modules/@microwiseai/license/dist/api/index.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/cache/file.d.ts +38 -0
- package/node_modules/@microwiseai/license/dist/cache/file.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/cache/file.js +140 -0
- package/node_modules/@microwiseai/license/dist/cache/file.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/cache/index.d.ts +7 -0
- package/node_modules/@microwiseai/license/dist/cache/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/cache/index.js +10 -0
- package/node_modules/@microwiseai/license/dist/cache/index.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/cache/memory.d.ts +35 -0
- package/node_modules/@microwiseai/license/dist/cache/memory.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/cache/memory.js +77 -0
- package/node_modules/@microwiseai/license/dist/cache/memory.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/cache/offline.d.ts +29 -0
- package/node_modules/@microwiseai/license/dist/cache/offline.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/cache/offline.js +58 -0
- package/node_modules/@microwiseai/license/dist/cache/offline.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/client.d.ts +42 -0
- package/node_modules/@microwiseai/license/dist/client.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/client.js +83 -0
- package/node_modules/@microwiseai/license/dist/client.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/config.d.ts +27 -0
- package/node_modules/@microwiseai/license/dist/config.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/config.js +52 -0
- package/node_modules/@microwiseai/license/dist/config.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/core/activate.d.ts +21 -0
- package/node_modules/@microwiseai/license/dist/core/activate.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/core/activate.js +72 -0
- package/node_modules/@microwiseai/license/dist/core/activate.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/core/check.d.ts +19 -0
- package/node_modules/@microwiseai/license/dist/core/check.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/core/check.js +244 -0
- package/node_modules/@microwiseai/license/dist/core/check.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/core/index.d.ts +7 -0
- package/node_modules/@microwiseai/license/dist/core/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/core/index.js +10 -0
- package/node_modules/@microwiseai/license/dist/core/index.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/core/verify.d.ts +39 -0
- package/node_modules/@microwiseai/license/dist/core/verify.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/core/verify.js +188 -0
- package/node_modules/@microwiseai/license/dist/core/verify.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/env.d.ts +33 -0
- package/node_modules/@microwiseai/license/dist/env.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/env.js +69 -0
- package/node_modules/@microwiseai/license/dist/env.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/helpers/cache.d.ts +97 -0
- package/node_modules/@microwiseai/license/dist/helpers/cache.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/helpers/cache.js +198 -0
- package/node_modules/@microwiseai/license/dist/helpers/cache.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/helpers/index.d.ts +7 -0
- package/node_modules/@microwiseai/license/dist/helpers/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/helpers/index.js +9 -0
- package/node_modules/@microwiseai/license/dist/helpers/index.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/helpers/telemetry.d.ts +68 -0
- package/node_modules/@microwiseai/license/dist/helpers/telemetry.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/helpers/telemetry.js +119 -0
- package/node_modules/@microwiseai/license/dist/helpers/telemetry.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/index.d.ts +34 -0
- package/node_modules/@microwiseai/license/dist/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/index.js +48 -0
- package/node_modules/@microwiseai/license/dist/index.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/machine/id.d.ts +19 -0
- package/node_modules/@microwiseai/license/dist/machine/id.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/machine/id.js +83 -0
- package/node_modules/@microwiseai/license/dist/machine/id.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/machine/index.d.ts +6 -0
- package/node_modules/@microwiseai/license/dist/machine/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/machine/index.js +6 -0
- package/node_modules/@microwiseai/license/dist/machine/index.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/machine/instance.d.ts +23 -0
- package/node_modules/@microwiseai/license/dist/machine/instance.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/machine/instance.js +52 -0
- package/node_modules/@microwiseai/license/dist/machine/instance.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/telemetry/index.d.ts +6 -0
- package/node_modules/@microwiseai/license/dist/telemetry/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/telemetry/index.js +6 -0
- package/node_modules/@microwiseai/license/dist/telemetry/index.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/telemetry/manager.d.ts +53 -0
- package/node_modules/@microwiseai/license/dist/telemetry/manager.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/telemetry/manager.js +125 -0
- package/node_modules/@microwiseai/license/dist/telemetry/manager.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/telemetry/payload.d.ts +17 -0
- package/node_modules/@microwiseai/license/dist/telemetry/payload.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/telemetry/payload.js +65 -0
- package/node_modules/@microwiseai/license/dist/telemetry/payload.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/types/api.d.ts +120 -0
- package/node_modules/@microwiseai/license/dist/types/api.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/types/api.js +5 -0
- package/node_modules/@microwiseai/license/dist/types/api.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/types/config.d.ts +80 -0
- package/node_modules/@microwiseai/license/dist/types/config.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/types/config.js +12 -0
- package/node_modules/@microwiseai/license/dist/types/config.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/types/errors.d.ts +93 -0
- package/node_modules/@microwiseai/license/dist/types/errors.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/types/errors.js +144 -0
- package/node_modules/@microwiseai/license/dist/types/errors.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/types/index.d.ts +10 -0
- package/node_modules/@microwiseai/license/dist/types/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/types/index.js +6 -0
- package/node_modules/@microwiseai/license/dist/types/index.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/types/license.d.ts +113 -0
- package/node_modules/@microwiseai/license/dist/types/license.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/types/license.js +5 -0
- package/node_modules/@microwiseai/license/dist/types/license.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/utils/date.d.ts +45 -0
- package/node_modules/@microwiseai/license/dist/utils/date.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/utils/date.js +95 -0
- package/node_modules/@microwiseai/license/dist/utils/date.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/utils/env.d.ts +41 -0
- package/node_modules/@microwiseai/license/dist/utils/env.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/utils/env.js +80 -0
- package/node_modules/@microwiseai/license/dist/utils/env.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/utils/index.d.ts +7 -0
- package/node_modules/@microwiseai/license/dist/utils/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/utils/index.js +7 -0
- package/node_modules/@microwiseai/license/dist/utils/index.js.map +1 -0
- package/node_modules/@microwiseai/license/dist/utils/mask.d.ts +27 -0
- package/node_modules/@microwiseai/license/dist/utils/mask.d.ts.map +1 -0
- package/node_modules/@microwiseai/license/dist/utils/mask.js +67 -0
- package/node_modules/@microwiseai/license/dist/utils/mask.js.map +1 -0
- package/node_modules/@microwiseai/license/package.json +52 -0
- package/node_modules/@microwiseai/license-types/README.md +84 -0
- package/node_modules/@microwiseai/license-types/dist/api.d.ts +120 -0
- package/node_modules/@microwiseai/license-types/dist/api.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-types/dist/api.js +5 -0
- package/node_modules/@microwiseai/license-types/dist/api.js.map +1 -0
- package/node_modules/@microwiseai/license-types/dist/config.d.ts +80 -0
- package/node_modules/@microwiseai/license-types/dist/config.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-types/dist/config.js +12 -0
- package/node_modules/@microwiseai/license-types/dist/config.js.map +1 -0
- package/node_modules/@microwiseai/license-types/dist/errors.d.ts +93 -0
- package/node_modules/@microwiseai/license-types/dist/errors.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-types/dist/errors.js +144 -0
- package/node_modules/@microwiseai/license-types/dist/errors.js.map +1 -0
- package/node_modules/@microwiseai/license-types/dist/index.d.ts +10 -0
- package/node_modules/@microwiseai/license-types/dist/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-types/dist/index.js +6 -0
- package/node_modules/@microwiseai/license-types/dist/index.js.map +1 -0
- package/node_modules/@microwiseai/license-types/dist/license.d.ts +113 -0
- package/node_modules/@microwiseai/license-types/dist/license.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-types/dist/license.js +5 -0
- package/node_modules/@microwiseai/license-types/dist/license.js.map +1 -0
- package/node_modules/@microwiseai/license-types/package.json +38 -0
- package/node_modules/@microwiseai/license-utils/README.md +82 -0
- package/node_modules/@microwiseai/license-utils/dist/__tests__/machine.test.d.ts +2 -0
- package/node_modules/@microwiseai/license-utils/dist/__tests__/machine.test.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/__tests__/machine.test.js +124 -0
- package/node_modules/@microwiseai/license-utils/dist/__tests__/machine.test.js.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/index.d.ts +7 -0
- package/node_modules/@microwiseai/license-utils/dist/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/index.js +15 -0
- package/node_modules/@microwiseai/license-utils/dist/index.js.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/id.d.ts +19 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/id.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/id.js +83 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/id.js.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/index.d.ts +6 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/index.js +6 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/index.js.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/instance.d.ts +23 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/instance.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/instance.js +52 -0
- package/node_modules/@microwiseai/license-utils/dist/machine/instance.js.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/date.d.ts +45 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/date.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/date.js +95 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/date.js.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/env.d.ts +16 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/env.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/env.js +22 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/env.js.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/index.d.ts +7 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/index.js +7 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/index.js.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/mask.d.ts +27 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/mask.d.ts.map +1 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/mask.js +67 -0
- package/node_modules/@microwiseai/license-utils/dist/utils/mask.js.map +1 -0
- package/node_modules/@microwiseai/license-utils/package.json +45 -0
- package/node_modules/@microwiseai/telemetry/README.md +86 -0
- package/node_modules/@microwiseai/telemetry/dist/index.d.ts +9 -0
- package/node_modules/@microwiseai/telemetry/dist/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/telemetry/dist/index.js +10 -0
- package/node_modules/@microwiseai/telemetry/dist/index.js.map +1 -0
- package/node_modules/@microwiseai/telemetry/dist/manager.d.ts +71 -0
- package/node_modules/@microwiseai/telemetry/dist/manager.d.ts.map +1 -0
- package/node_modules/@microwiseai/telemetry/dist/manager.js +171 -0
- package/node_modules/@microwiseai/telemetry/dist/manager.js.map +1 -0
- package/node_modules/@microwiseai/telemetry/dist/payload.d.ts +13 -0
- package/node_modules/@microwiseai/telemetry/dist/payload.d.ts.map +1 -0
- package/node_modules/@microwiseai/telemetry/dist/payload.js +35 -0
- package/node_modules/@microwiseai/telemetry/dist/payload.js.map +1 -0
- package/node_modules/@microwiseai/telemetry/dist/types.d.ts +76 -0
- package/node_modules/@microwiseai/telemetry/dist/types.d.ts.map +1 -0
- package/node_modules/@microwiseai/telemetry/dist/types.js +13 -0
- package/node_modules/@microwiseai/telemetry/dist/types.js.map +1 -0
- package/node_modules/@microwiseai/telemetry/package.json +43 -0
- package/node_modules/chalk/license +9 -0
- package/node_modules/chalk/package.json +83 -0
- package/node_modules/chalk/readme.md +297 -0
- package/node_modules/chalk/source/index.d.ts +325 -0
- package/node_modules/chalk/source/index.js +225 -0
- package/node_modules/chalk/source/utilities.js +33 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
- package/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
- package/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
- package/package.json +26 -2
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offline grace period management
|
|
3
|
+
*/
|
|
4
|
+
import { readCache } from './file.js';
|
|
5
|
+
import { daysRemaining } from '@microwiseai/license-utils';
|
|
6
|
+
/**
|
|
7
|
+
* Check if still within offline grace period
|
|
8
|
+
*/
|
|
9
|
+
export function isWithinOfflineGrace(vendorName) {
|
|
10
|
+
const cache = readCache(vendorName);
|
|
11
|
+
if (!cache) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
// Must have been valid at last check
|
|
15
|
+
if (!cache.valid) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const graceUntil = new Date(cache.offlineGraceUntil);
|
|
19
|
+
return graceUntil > new Date();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get days remaining in offline grace period
|
|
23
|
+
*/
|
|
24
|
+
export function getOfflineGraceDaysRemaining(vendorName) {
|
|
25
|
+
const cache = readCache(vendorName);
|
|
26
|
+
if (!cache) {
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
return daysRemaining(cache.offlineGraceUntil);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get offline grace status
|
|
33
|
+
*/
|
|
34
|
+
export function getOfflineGraceStatus(vendorName) {
|
|
35
|
+
const cache = readCache(vendorName);
|
|
36
|
+
if (!cache) {
|
|
37
|
+
return {
|
|
38
|
+
withinGrace: false,
|
|
39
|
+
daysRemaining: 0,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const graceUntil = new Date(cache.offlineGraceUntil);
|
|
43
|
+
const withinGrace = cache.valid && graceUntil > new Date();
|
|
44
|
+
return {
|
|
45
|
+
withinGrace,
|
|
46
|
+
daysRemaining: daysRemaining(cache.offlineGraceUntil),
|
|
47
|
+
graceUntil,
|
|
48
|
+
lastVerified: new Date(cache.verifiedAt),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get last server response from cache (for offline mode)
|
|
53
|
+
*/
|
|
54
|
+
export function getLastServerResponse(vendorName) {
|
|
55
|
+
const cache = readCache(vendorName);
|
|
56
|
+
return cache?.lastServerResponse ?? null;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=offline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline.js","sourceRoot":"","sources":["../../src/cache/offline.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAkB;IACrD,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,qCAAqC;IACrC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrD,OAAO,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,UAAkB;IAC7D,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IAMtD,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAEpC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,WAAW,EAAE,KAAK;YAClB,aAAa,EAAE,CAAC;SACjB,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,IAAI,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;IAE3D,OAAO;QACL,WAAW;QACX,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC;QACrD,UAAU;QACV,YAAY,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;KACzC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IAKtD,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IACpC,OAAO,KAAK,EAAE,kBAAkB,IAAI,IAAI,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License client factory
|
|
3
|
+
*/
|
|
4
|
+
import type { LicenseConfig, LicenseResult, LicenseData, ActivationResult, DeactivationResult, CheckOptions, ActivateOptions, DeactivateOptions, ReportOptions, TelemetryStatus } from '@microwiseai/license-types';
|
|
5
|
+
/**
|
|
6
|
+
* License client interface
|
|
7
|
+
*/
|
|
8
|
+
export interface LicenseClient {
|
|
9
|
+
/** Configuration */
|
|
10
|
+
readonly config: LicenseConfig;
|
|
11
|
+
/** Check license validity (returns result) */
|
|
12
|
+
checkLicense(options?: CheckOptions): Promise<LicenseResult>;
|
|
13
|
+
/** Require valid license (throws on failure) */
|
|
14
|
+
requireLicense(options?: CheckOptions): Promise<void>;
|
|
15
|
+
/** Activate a license key */
|
|
16
|
+
activateLicense(key: string, options?: ActivateOptions): Promise<ActivationResult>;
|
|
17
|
+
/** Deactivate current license */
|
|
18
|
+
deactivateLicense(options?: DeactivateOptions): Promise<DeactivationResult>;
|
|
19
|
+
/** Report usage to telemetry */
|
|
20
|
+
reportUsage(status: TelemetryStatus, options?: ReportOptions): Promise<void>;
|
|
21
|
+
/** Get machine ID */
|
|
22
|
+
getMachineId(): string;
|
|
23
|
+
/** Get instance name */
|
|
24
|
+
getInstanceName(): string;
|
|
25
|
+
/** Get local license info (without verification) */
|
|
26
|
+
getLicenseInfo(): LicenseData | null;
|
|
27
|
+
/** Clear all caches */
|
|
28
|
+
clearCache(): void;
|
|
29
|
+
/** Disable telemetry */
|
|
30
|
+
disableTelemetry(): void;
|
|
31
|
+
/** Enable telemetry */
|
|
32
|
+
enableTelemetry(): void;
|
|
33
|
+
/** Check if telemetry is enabled */
|
|
34
|
+
isTelemetryEnabled(): boolean;
|
|
35
|
+
/** Cleanup resources (call on shutdown) */
|
|
36
|
+
destroy(): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Create a license client instance
|
|
40
|
+
*/
|
|
41
|
+
export declare function createLicenseClient(config: LicenseConfig): LicenseClient;
|
|
42
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAKpC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,oBAAoB;IACpB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAE/B,8CAA8C;IAC9C,YAAY,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAE7D,gDAAgD;IAChD,cAAc,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD,6BAA6B;IAC7B,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEnF,iCAAiC;IACjC,iBAAiB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAE5E,gCAAgC;IAChC,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAI7E,qBAAqB;IACrB,YAAY,IAAI,MAAM,CAAC;IAEvB,wBAAwB;IACxB,eAAe,IAAI,MAAM,CAAC;IAE1B,oDAAoD;IACpD,cAAc,IAAI,WAAW,GAAG,IAAI,CAAC;IAErC,uBAAuB;IACvB,UAAU,IAAI,IAAI,CAAC;IAInB,wBAAwB;IACxB,gBAAgB,IAAI,IAAI,CAAC;IAEzB,uBAAuB;IACvB,eAAe,IAAI,IAAI,CAAC;IAExB,oCAAoC;IACpC,kBAAkB,IAAI,OAAO,CAAC;IAE9B,2CAA2C;IAC3C,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CA6FxE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License client factory
|
|
3
|
+
*/
|
|
4
|
+
import { checkLicense, requireLicense, activateLicense, deactivateLicense, getLicenseInfo } from './core/index.js';
|
|
5
|
+
import { getMachineId, getInstanceName } from '@microwiseai/license-utils';
|
|
6
|
+
import { clearMemoryCache, deleteCache, TelemetryManager } from './helpers/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create a license client instance
|
|
9
|
+
*/
|
|
10
|
+
export function createLicenseClient(config) {
|
|
11
|
+
// Create telemetry manager
|
|
12
|
+
const telemetry = new TelemetryManager(config);
|
|
13
|
+
// Start auto telemetry if configured
|
|
14
|
+
if (config.autoTelemetry) {
|
|
15
|
+
telemetry.startAutoReport();
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
config,
|
|
19
|
+
async checkLicense(options) {
|
|
20
|
+
const result = await checkLicense(config, options);
|
|
21
|
+
// Report to telemetry (non-blocking)
|
|
22
|
+
if (telemetry.isEnabled()) {
|
|
23
|
+
const status = result.valid
|
|
24
|
+
? result.license?.isTrial
|
|
25
|
+
? 'trial'
|
|
26
|
+
: 'valid'
|
|
27
|
+
: result.license
|
|
28
|
+
? 'invalid'
|
|
29
|
+
: 'none';
|
|
30
|
+
telemetry.report(status);
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
},
|
|
34
|
+
async requireLicense(options) {
|
|
35
|
+
return requireLicense(config, options);
|
|
36
|
+
},
|
|
37
|
+
async activateLicense(key, options) {
|
|
38
|
+
const result = await activateLicense(config, key, options);
|
|
39
|
+
// Report activation to telemetry
|
|
40
|
+
if (result.success && telemetry.isEnabled()) {
|
|
41
|
+
telemetry.report('valid');
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
},
|
|
45
|
+
async deactivateLicense(options) {
|
|
46
|
+
const result = await deactivateLicense(config, options);
|
|
47
|
+
// Report deactivation to telemetry
|
|
48
|
+
if (result.success && telemetry.isEnabled()) {
|
|
49
|
+
telemetry.report('none');
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
},
|
|
53
|
+
async reportUsage(status, options) {
|
|
54
|
+
return telemetry.report(status, options);
|
|
55
|
+
},
|
|
56
|
+
getMachineId() {
|
|
57
|
+
return getMachineId(config.vendorName);
|
|
58
|
+
},
|
|
59
|
+
getInstanceName() {
|
|
60
|
+
return getInstanceName();
|
|
61
|
+
},
|
|
62
|
+
getLicenseInfo() {
|
|
63
|
+
return getLicenseInfo(config);
|
|
64
|
+
},
|
|
65
|
+
clearCache() {
|
|
66
|
+
clearMemoryCache(config.vendorName);
|
|
67
|
+
deleteCache(config.vendorName);
|
|
68
|
+
},
|
|
69
|
+
disableTelemetry() {
|
|
70
|
+
telemetry.disable();
|
|
71
|
+
},
|
|
72
|
+
enableTelemetry() {
|
|
73
|
+
telemetry.enable();
|
|
74
|
+
},
|
|
75
|
+
isTelemetryEnabled() {
|
|
76
|
+
return telemetry.isEnabled();
|
|
77
|
+
},
|
|
78
|
+
destroy() {
|
|
79
|
+
telemetry.destroy();
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAqDrF;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAqB;IACvD,2BAA2B;IAC3B,MAAM,SAAS,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE/C,qCAAqC;IACrC,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;QACzB,SAAS,CAAC,eAAe,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO;QACL,MAAM;QAEN,KAAK,CAAC,YAAY,CAAC,OAAsB;YACvC,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAEnD,qCAAqC;YACrC,IAAI,SAAS,CAAC,SAAS,EAAE,EAAE,CAAC;gBAC1B,MAAM,MAAM,GAAoB,MAAM,CAAC,KAAK;oBAC1C,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO;wBACvB,CAAC,CAAC,OAAO;wBACT,CAAC,CAAC,OAAO;oBACX,CAAC,CAAC,MAAM,CAAC,OAAO;wBACd,CAAC,CAAC,SAAS;wBACX,CAAC,CAAC,MAAM,CAAC;gBACb,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC3B,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,KAAK,CAAC,cAAc,CAAC,OAAsB;YACzC,OAAO,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;QAED,KAAK,CAAC,eAAe,CAAC,GAAW,EAAE,OAAyB;YAC1D,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;YAE3D,iCAAiC;YACjC,IAAI,MAAM,CAAC,OAAO,IAAI,SAAS,CAAC,SAAS,EAAE,EAAE,CAAC;gBAC5C,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC5B,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,KAAK,CAAC,iBAAiB,CAAC,OAA2B;YACjD,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAExD,mCAAmC;YACnC,IAAI,MAAM,CAAC,OAAO,IAAI,SAAS,CAAC,SAAS,EAAE,EAAE,CAAC;gBAC5C,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC3B,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,KAAK,CAAC,WAAW,CAAC,MAAuB,EAAE,OAAuB;YAChE,OAAO,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC3C,CAAC;QAED,YAAY;YACV,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACzC,CAAC;QAED,eAAe;YACb,OAAO,eAAe,EAAE,CAAC;QAC3B,CAAC;QAED,cAAc;YACZ,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;QAED,UAAU;YACR,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACpC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACjC,CAAC;QAED,gBAAgB;YACd,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;QAED,eAAe;YACb,SAAS,CAAC,MAAM,EAAE,CAAC;QACrB,CAAC;QAED,kBAAkB;YAChB,OAAO,SAAS,CAAC,SAAS,EAAE,CAAC;QAC/B,CAAC;QAED,OAAO;YACL,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global configuration management
|
|
3
|
+
*/
|
|
4
|
+
import type { LicenseConfig, ResolvedConfig } from '@microwiseai/license-types';
|
|
5
|
+
/**
|
|
6
|
+
* Configure global license settings
|
|
7
|
+
* Use this for single-vendor applications
|
|
8
|
+
*/
|
|
9
|
+
export declare function configure(config: LicenseConfig): void;
|
|
10
|
+
/**
|
|
11
|
+
* Get current global configuration
|
|
12
|
+
* Throws if not configured
|
|
13
|
+
*/
|
|
14
|
+
export declare function getConfig(): LicenseConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Check if global configuration exists
|
|
17
|
+
*/
|
|
18
|
+
export declare function isConfigured(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Clear global configuration
|
|
21
|
+
*/
|
|
22
|
+
export declare function clearConfig(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Resolve configuration with defaults
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveConfig(config: LicenseConfig): ResolvedConfig;
|
|
27
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAMhF;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAErD;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,aAAa,CAOzC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,cAAc,CAYnE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global configuration management
|
|
3
|
+
*/
|
|
4
|
+
import { CONFIG_DEFAULTS } from '@microwiseai/license-types';
|
|
5
|
+
// Global configuration store
|
|
6
|
+
let globalConfig = null;
|
|
7
|
+
/**
|
|
8
|
+
* Configure global license settings
|
|
9
|
+
* Use this for single-vendor applications
|
|
10
|
+
*/
|
|
11
|
+
export function configure(config) {
|
|
12
|
+
globalConfig = config;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get current global configuration
|
|
16
|
+
* Throws if not configured
|
|
17
|
+
*/
|
|
18
|
+
export function getConfig() {
|
|
19
|
+
if (!globalConfig) {
|
|
20
|
+
throw new Error('License not configured. Call configure() first or use createLicenseClient() for explicit configuration.');
|
|
21
|
+
}
|
|
22
|
+
return globalConfig;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Check if global configuration exists
|
|
26
|
+
*/
|
|
27
|
+
export function isConfigured() {
|
|
28
|
+
return globalConfig !== null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Clear global configuration
|
|
32
|
+
*/
|
|
33
|
+
export function clearConfig() {
|
|
34
|
+
globalConfig = null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Resolve configuration with defaults
|
|
38
|
+
*/
|
|
39
|
+
export function resolveConfig(config) {
|
|
40
|
+
return {
|
|
41
|
+
vendorName: config.vendorName,
|
|
42
|
+
apiUrl: config.apiUrl,
|
|
43
|
+
telemetryUrl: config.telemetryUrl,
|
|
44
|
+
envPrefix: config.envPrefix ?? config.vendorName.toUpperCase().replace(/[^A-Z0-9]/g, '_'),
|
|
45
|
+
cliCommand: config.cliCommand ?? `${config.vendorName} license`,
|
|
46
|
+
storeUrl: config.storeUrl,
|
|
47
|
+
cacheTTL: config.cacheTTL ?? CONFIG_DEFAULTS.cacheTTL,
|
|
48
|
+
offlineGraceDays: config.offlineGraceDays ?? CONFIG_DEFAULTS.offlineGraceDays,
|
|
49
|
+
autoTelemetry: config.autoTelemetry ?? CONFIG_DEFAULTS.autoTelemetry,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,6BAA6B;AAC7B,IAAI,YAAY,GAAyB,IAAI,CAAC;AAE9C;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,MAAqB;IAC7C,YAAY,GAAG,MAAM,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACb,yGAAyG,CAC1G,CAAC;IACJ,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,YAAY,KAAK,IAAI,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAqB;IACjD,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC;QACzF,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,GAAG,MAAM,CAAC,UAAU,UAAU;QAC/D,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,eAAe,CAAC,QAAQ;QACrD,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,eAAe,CAAC,gBAAgB;QAC7E,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,eAAe,CAAC,aAAa;KACrE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License activation and deactivation
|
|
3
|
+
*/
|
|
4
|
+
import type { LicenseConfig, LicenseData, ActivationResult, DeactivationResult, ActivateOptions, DeactivateOptions } from '@microwiseai/license-types';
|
|
5
|
+
/**
|
|
6
|
+
* Activate a license key on this machine
|
|
7
|
+
*/
|
|
8
|
+
export declare function activateLicense(config: LicenseConfig, key: string, options?: ActivateOptions): Promise<ActivationResult>;
|
|
9
|
+
/**
|
|
10
|
+
* Deactivate license on this machine
|
|
11
|
+
*/
|
|
12
|
+
export declare function deactivateLicense(config: LicenseConfig, options?: DeactivateOptions): Promise<DeactivationResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Get current license info (without verification)
|
|
15
|
+
*/
|
|
16
|
+
export declare function getLicenseInfo(config: LicenseConfig): LicenseData | null;
|
|
17
|
+
/**
|
|
18
|
+
* Check if license exists locally
|
|
19
|
+
*/
|
|
20
|
+
export declare function hasLicense(config: LicenseConfig): boolean;
|
|
21
|
+
//# sourceMappingURL=activate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activate.d.ts","sourceRoot":"","sources":["../../src/core/activate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AAIpC;;GAEG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,gBAAgB,CAAC,CAiC3B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAsB7B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,IAAI,CAExE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAEzD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License activation and deactivation
|
|
3
|
+
*/
|
|
4
|
+
import { activateLicense as activateLicenseApi, deactivateLicense as deactivateLicenseApi } from '../api/index.js';
|
|
5
|
+
import { writeLicense, writeCache, deleteLicense, readLicense, clearMemoryCache } from '../helpers/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Activate a license key on this machine
|
|
8
|
+
*/
|
|
9
|
+
export async function activateLicense(config, key, options) {
|
|
10
|
+
const result = await activateLicenseApi(config, key, {
|
|
11
|
+
instanceName: options?.instanceName,
|
|
12
|
+
});
|
|
13
|
+
if (result.success) {
|
|
14
|
+
// Save license data locally
|
|
15
|
+
const licenseData = {
|
|
16
|
+
licenseKey: key,
|
|
17
|
+
productId: result.productId ?? 'unknown',
|
|
18
|
+
productName: result.productName ?? 'Unknown Product',
|
|
19
|
+
status: 'active',
|
|
20
|
+
type: result.type ?? 'subscription',
|
|
21
|
+
expiresAt: result.expiresAt,
|
|
22
|
+
activatedAt: result.activatedAt ?? new Date().toISOString(),
|
|
23
|
+
instanceName: result.instanceName,
|
|
24
|
+
activationId: result.activationId,
|
|
25
|
+
};
|
|
26
|
+
writeLicense(config.vendorName, licenseData);
|
|
27
|
+
// Initialize cache
|
|
28
|
+
writeCache(config, true, {
|
|
29
|
+
type: licenseData.type,
|
|
30
|
+
status: licenseData.status,
|
|
31
|
+
expiresAt: licenseData.expiresAt,
|
|
32
|
+
});
|
|
33
|
+
// Clear memory cache to force fresh read
|
|
34
|
+
clearMemoryCache(config.vendorName);
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Deactivate license on this machine
|
|
40
|
+
*/
|
|
41
|
+
export async function deactivateLicense(config, options) {
|
|
42
|
+
const license = readLicense(config.vendorName);
|
|
43
|
+
if (!license) {
|
|
44
|
+
return {
|
|
45
|
+
success: false,
|
|
46
|
+
error: 'No license found to deactivate',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const result = await deactivateLicenseApi(config, license.licenseKey, {
|
|
50
|
+
activationId: license.activationId,
|
|
51
|
+
deactivateAll: options?.deactivateAll,
|
|
52
|
+
});
|
|
53
|
+
if (result.success) {
|
|
54
|
+
// Remove local license data
|
|
55
|
+
deleteLicense(config.vendorName);
|
|
56
|
+
clearMemoryCache(config.vendorName);
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get current license info (without verification)
|
|
62
|
+
*/
|
|
63
|
+
export function getLicenseInfo(config) {
|
|
64
|
+
return readLicense(config.vendorName);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Check if license exists locally
|
|
68
|
+
*/
|
|
69
|
+
export function hasLicense(config) {
|
|
70
|
+
return readLicense(config.vendorName) !== null;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=activate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activate.js","sourceRoot":"","sources":["../../src/core/activate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,OAAO,EAAE,eAAe,IAAI,kBAAkB,EAAE,iBAAiB,IAAI,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE7G;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAqB,EACrB,GAAW,EACX,OAAyB;IAEzB,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,GAAG,EAAE;QACnD,YAAY,EAAE,OAAO,EAAE,YAAY;KACpC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,4BAA4B;QAC5B,MAAM,WAAW,GAAgB;YAC/B,UAAU,EAAE,GAAG;YACf,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,SAAS;YACxC,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,iBAAiB;YACpD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,cAAc;YACnC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAC3D,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC;QAEF,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAE7C,mBAAmB;QACnB,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE;YACvB,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,SAAS,EAAE,WAAW,CAAC,SAAS;SACjC,CAAC,CAAC;QAEH,yCAAyC;QACzC,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAqB,EACrB,OAA2B;IAE3B,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAE/C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,gCAAgC;SACxC,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE;QACpE,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,aAAa,EAAE,OAAO,EAAE,aAAa;KACtC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,4BAA4B;QAC5B,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACjC,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAAqB;IAClD,OAAO,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAAqB;IAC9C,OAAO,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License check logic
|
|
3
|
+
* Integrates cache, API, and offline handling
|
|
4
|
+
*/
|
|
5
|
+
import type { LicenseConfig, LicenseResult, CheckOptions, TelemetryStatus } from '@microwiseai/license-types';
|
|
6
|
+
/**
|
|
7
|
+
* Check license validity
|
|
8
|
+
* Returns result without throwing
|
|
9
|
+
*/
|
|
10
|
+
export declare function checkLicense(config: LicenseConfig, options?: CheckOptions): Promise<LicenseResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Require valid license or throw
|
|
13
|
+
*/
|
|
14
|
+
export declare function requireLicense(config: LicenseConfig, options?: CheckOptions): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Get telemetry status from result
|
|
17
|
+
*/
|
|
18
|
+
export declare function getTelemetryStatus(result: LicenseResult): TelemetryStatus;
|
|
19
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/core/check.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,YAAY,EACZ,eAAe,EAEhB,MAAM,4BAA4B,CAAC;AAgBpC;;;GAGG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAOxG;AAwID;;GAEG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCjG;AA2DD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe,CAczE"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License check logic
|
|
3
|
+
* Integrates cache, API, and offline handling
|
|
4
|
+
*/
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
import { LicenseError } from '@microwiseai/license-types';
|
|
7
|
+
import { markLicenseChecked } from '@microwiseai/import-telemetry';
|
|
8
|
+
import { readLicense, writeCache, isFileCacheValid, getMemoryCache, setMemoryCache, clearMemoryCache, isWithinOfflineGrace, getOfflineGraceDaysRemaining, } from '../helpers/index.js';
|
|
9
|
+
import { verifyLicense as verifyLicenseApi } from '../api/index.js';
|
|
10
|
+
import { verifyLicenseByType, checkProductMatch, buildLicenseInfo } from './verify.js';
|
|
11
|
+
/**
|
|
12
|
+
* Check license validity
|
|
13
|
+
* Returns result without throwing
|
|
14
|
+
*/
|
|
15
|
+
export async function checkLicense(config, options) {
|
|
16
|
+
// Mark license as checked for import-telemetry bypass detection
|
|
17
|
+
// Uses vendorName as the package identifier
|
|
18
|
+
markLicenseChecked(config.vendorName);
|
|
19
|
+
const result = await checkLicenseInternal(config, options);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Internal license check logic
|
|
24
|
+
*/
|
|
25
|
+
async function checkLicenseInternal(config, options) {
|
|
26
|
+
const { vendorName } = config;
|
|
27
|
+
// Read local license
|
|
28
|
+
const license = readLicense(vendorName);
|
|
29
|
+
if (!license) {
|
|
30
|
+
return {
|
|
31
|
+
valid: false,
|
|
32
|
+
reason: 'No license found. Please activate a license first.',
|
|
33
|
+
cached: false,
|
|
34
|
+
offlineMode: false,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
// Check product match
|
|
38
|
+
const productMatch = checkProductMatch(license, {
|
|
39
|
+
productId: options?.productId,
|
|
40
|
+
productIds: options?.productIds,
|
|
41
|
+
});
|
|
42
|
+
if (!productMatch.matches) {
|
|
43
|
+
return {
|
|
44
|
+
valid: false,
|
|
45
|
+
reason: productMatch.reason,
|
|
46
|
+
license: buildLicenseInfo(license),
|
|
47
|
+
cached: false,
|
|
48
|
+
offlineMode: false,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
// 1. Check memory cache (unless force verify)
|
|
52
|
+
if (!options?.forceVerify) {
|
|
53
|
+
const memoryCached = getMemoryCache(vendorName);
|
|
54
|
+
if (memoryCached) {
|
|
55
|
+
return { ...memoryCached, cached: true };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// 2. Check file cache (unless force verify)
|
|
59
|
+
if (!options?.forceVerify && isFileCacheValid(vendorName)) {
|
|
60
|
+
const result = verifyLicenseByType(license);
|
|
61
|
+
if (result.valid) {
|
|
62
|
+
const cachedResult = { ...result, cached: true };
|
|
63
|
+
setMemoryCache(vendorName, cachedResult);
|
|
64
|
+
return cachedResult;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// 3. Verify with API
|
|
68
|
+
try {
|
|
69
|
+
const apiResult = await verifyLicenseApi(config, license.licenseKey, {
|
|
70
|
+
productId: options?.productId,
|
|
71
|
+
productGroup: options?.productGroup,
|
|
72
|
+
});
|
|
73
|
+
if (apiResult.valid && 'license' in apiResult) {
|
|
74
|
+
// Update cache with server response
|
|
75
|
+
const successResponse = apiResult;
|
|
76
|
+
writeCache(config, true, {
|
|
77
|
+
type: successResponse.license.type,
|
|
78
|
+
status: successResponse.license.status,
|
|
79
|
+
expiresAt: successResponse.license.expiresAt,
|
|
80
|
+
});
|
|
81
|
+
const result = {
|
|
82
|
+
valid: true,
|
|
83
|
+
license: {
|
|
84
|
+
key: successResponse.license.key,
|
|
85
|
+
productId: successResponse.license.productId,
|
|
86
|
+
productName: successResponse.license.productName,
|
|
87
|
+
status: successResponse.license.status,
|
|
88
|
+
type: successResponse.license.type,
|
|
89
|
+
expiresAt: successResponse.license.expiresAt
|
|
90
|
+
? new Date(successResponse.license.expiresAt)
|
|
91
|
+
: undefined,
|
|
92
|
+
features: license.features,
|
|
93
|
+
},
|
|
94
|
+
cached: false,
|
|
95
|
+
offlineMode: false,
|
|
96
|
+
};
|
|
97
|
+
setMemoryCache(vendorName, result);
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
// License not valid according to API
|
|
101
|
+
clearMemoryCache(vendorName);
|
|
102
|
+
return {
|
|
103
|
+
valid: false,
|
|
104
|
+
reason: 'error' in apiResult ? apiResult.error : 'License validation failed',
|
|
105
|
+
license: buildLicenseInfo(license),
|
|
106
|
+
cached: false,
|
|
107
|
+
offlineMode: false,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
// 4. Network error - check offline grace period
|
|
112
|
+
if (isWithinOfflineGrace(vendorName)) {
|
|
113
|
+
const daysLeft = getOfflineGraceDaysRemaining(vendorName);
|
|
114
|
+
const result = verifyLicenseByType(license);
|
|
115
|
+
if (result.valid) {
|
|
116
|
+
const offlineResult = {
|
|
117
|
+
...result,
|
|
118
|
+
reason: `Offline mode: ${daysLeft} days remaining`,
|
|
119
|
+
cached: true,
|
|
120
|
+
offlineMode: true,
|
|
121
|
+
license: result.license
|
|
122
|
+
? {
|
|
123
|
+
...result.license,
|
|
124
|
+
offlineDaysRemaining: daysLeft,
|
|
125
|
+
}
|
|
126
|
+
: undefined,
|
|
127
|
+
};
|
|
128
|
+
setMemoryCache(vendorName, offlineResult);
|
|
129
|
+
return offlineResult;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// Grace period exceeded
|
|
133
|
+
clearMemoryCache(vendorName);
|
|
134
|
+
return {
|
|
135
|
+
valid: false,
|
|
136
|
+
reason: 'Offline grace period exceeded. Please connect to verify your license.',
|
|
137
|
+
license: buildLicenseInfo(license),
|
|
138
|
+
cached: false,
|
|
139
|
+
offlineMode: true,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Require valid license or throw
|
|
145
|
+
*/
|
|
146
|
+
export async function requireLicense(config, options) {
|
|
147
|
+
const result = await checkLicense(config, options);
|
|
148
|
+
if (result.valid) {
|
|
149
|
+
// Show warning for offline mode
|
|
150
|
+
if (result.offlineMode && !options?.silent) {
|
|
151
|
+
const daysLeft = result.license?.offlineDaysRemaining ?? getOfflineGraceDaysRemaining(config.vendorName);
|
|
152
|
+
console.log(chalk.yellow('\n⚠️ Offline mode'));
|
|
153
|
+
console.log(chalk.gray('Unable to verify license (no internet connection).'));
|
|
154
|
+
console.log(chalk.gray(`Continuing with cached license. Please connect within ${daysLeft} days.\n`));
|
|
155
|
+
}
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
// License invalid - show error and throw
|
|
159
|
+
if (!options?.silent) {
|
|
160
|
+
printLicenseError(config, result);
|
|
161
|
+
}
|
|
162
|
+
throw new LicenseError(result.reason ?? 'License validation failed', getLicenseErrorCode(result), {
|
|
163
|
+
license: result.license
|
|
164
|
+
? {
|
|
165
|
+
licenseKey: result.license.key,
|
|
166
|
+
productId: result.license.productId,
|
|
167
|
+
productName: result.license.productName,
|
|
168
|
+
status: result.license.status,
|
|
169
|
+
type: result.license.type,
|
|
170
|
+
}
|
|
171
|
+
: undefined,
|
|
172
|
+
canConvertToPaid: result.canConvertToPaid,
|
|
173
|
+
storeUrl: config.storeUrl,
|
|
174
|
+
cliCommand: config.cliCommand,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Print license error message
|
|
179
|
+
*/
|
|
180
|
+
function printLicenseError(config, result) {
|
|
181
|
+
console.log(chalk.red('\n❌ License required\n'));
|
|
182
|
+
if (result.license) {
|
|
183
|
+
console.log(result.reason);
|
|
184
|
+
if (config.storeUrl) {
|
|
185
|
+
console.log(chalk.gray(`\nPlease renew your subscription at ${config.storeUrl}\n`));
|
|
186
|
+
}
|
|
187
|
+
console.log(chalk.gray(`License key: ${result.license.key}`));
|
|
188
|
+
console.log(chalk.gray(`Product: ${result.license.productName ?? result.license.productId}`));
|
|
189
|
+
console.log(chalk.gray(`Status: ${result.license.status}`));
|
|
190
|
+
if (result.license.expiresAt) {
|
|
191
|
+
console.log(chalk.gray(`Expires: ${result.license.expiresAt.toLocaleDateString()}`));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
console.log(result.reason);
|
|
196
|
+
if (config.cliCommand) {
|
|
197
|
+
console.log(chalk.gray('\nTo activate a license:'));
|
|
198
|
+
console.log(chalk.cyan(` ${config.cliCommand} activate <LICENSE_KEY>\n`));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get error code from result
|
|
204
|
+
*/
|
|
205
|
+
function getLicenseErrorCode(result) {
|
|
206
|
+
if (!result.license) {
|
|
207
|
+
return 'NO_LICENSE';
|
|
208
|
+
}
|
|
209
|
+
if (result.offlineMode) {
|
|
210
|
+
return 'OFFLINE_GRACE_EXCEEDED';
|
|
211
|
+
}
|
|
212
|
+
if (result.canConvertToPaid) {
|
|
213
|
+
return 'TRIAL_ENDED';
|
|
214
|
+
}
|
|
215
|
+
switch (result.license.status) {
|
|
216
|
+
case 'expired':
|
|
217
|
+
return 'EXPIRED';
|
|
218
|
+
case 'cancelled':
|
|
219
|
+
return 'CANCELLED';
|
|
220
|
+
case 'suspended':
|
|
221
|
+
return 'SUSPENDED';
|
|
222
|
+
default:
|
|
223
|
+
return 'NO_LICENSE';
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Get telemetry status from result
|
|
228
|
+
*/
|
|
229
|
+
export function getTelemetryStatus(result) {
|
|
230
|
+
if (result.valid) {
|
|
231
|
+
if (result.license?.isTrial) {
|
|
232
|
+
return 'trial';
|
|
233
|
+
}
|
|
234
|
+
return 'valid';
|
|
235
|
+
}
|
|
236
|
+
if (!result.license) {
|
|
237
|
+
return 'none';
|
|
238
|
+
}
|
|
239
|
+
if (result.license.status === 'expired' || result.canConvertToPaid) {
|
|
240
|
+
return 'expired';
|
|
241
|
+
}
|
|
242
|
+
return 'invalid';
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=check.js.map
|