@magek/common 0.0.1 → 0.0.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.
@@ -1,5 +1,5 @@
1
- import { TimeKey } from './uuid';
1
+ import { UUID } from './uuid';
2
2
  export interface SequenceKey {
3
3
  name: string;
4
- value: TimeKey;
4
+ value: UUID;
5
5
  }
@@ -3,16 +3,10 @@
3
3
  * Commands, Events or any other magek artifact.
4
4
  * New unique identifiers can be created using the
5
5
  * `UUID.generate` method.
6
+ *
7
+ * Uses UUIDv7 (RFC 9562) which provides time-ordering and
8
+ * lexicographic sortability with sub-millisecond precision.
6
9
  */
7
10
  export declare class UUID extends String {
8
11
  static generate(): UUID;
9
12
  }
10
- /** Time-based unique identifier. It's a string in the form <timestamp>-<random UUID>. */
11
- export declare class TimeKey extends String {
12
- /**
13
- * Time-based unique identifier generator
14
- * @param moment Number of milliseconds since epoch for the moment in which the identifier should be generated. It defaults to the current time.
15
- * @returns A unique identifier in the form "<moment>-<random UUID>"
16
- */
17
- static generate(moment?: number): TimeKey;
18
- }
@@ -1,28 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimeKey = exports.UUID = void 0;
3
+ exports.UUID = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  /**
6
6
  * `UUID` type to work globally as a identifier for Entities,
7
7
  * Commands, Events or any other magek artifact.
8
8
  * New unique identifiers can be created using the
9
9
  * `UUID.generate` method.
10
+ *
11
+ * Uses UUIDv7 (RFC 9562) which provides time-ordering and
12
+ * lexicographic sortability with sub-millisecond precision.
10
13
  */
11
14
  class UUID extends String {
12
15
  static generate() {
13
- return (0, uuid_1.v4)();
16
+ return (0, uuid_1.v7)();
14
17
  }
15
18
  }
16
19
  exports.UUID = UUID;
17
- /** Time-based unique identifier. It's a string in the form <timestamp>-<random UUID>. */
18
- class TimeKey extends String {
19
- /**
20
- * Time-based unique identifier generator
21
- * @param moment Number of milliseconds since epoch for the moment in which the identifier should be generated. It defaults to the current time.
22
- * @returns A unique identifier in the form "<moment>-<random UUID>"
23
- */
24
- static generate(moment = Date.now()) {
25
- return `${moment}-${(0, uuid_1.v4)()}`;
26
- }
27
- }
28
- exports.TimeKey = TimeKey;
package/dist/config.d.ts CHANGED
@@ -8,7 +8,7 @@ import { HealthIndicatorMetadata, Logger, SensorConfiguration } from '.';
8
8
  import { TraceConfiguration } from './instrumentation/trace-types';
9
9
  /**
10
10
  * Class used by external packages that needs to get a representation of
11
- * the Magek config. Used mainly for vendor-specific deployment packages
11
+ * the Magek config.
12
12
  */
13
13
  export declare class MagekConfig {
14
14
  readonly environmentName: string;
package/dist/config.js CHANGED
@@ -6,7 +6,7 @@ const path = require("path");
6
6
  const _1 = require(".");
7
7
  /**
8
8
  * Class used by external packages that needs to get a representation of
9
- * the Magek config. Used mainly for vendor-specific deployment packages
9
+ * the Magek config.
10
10
  */
11
11
  class MagekConfig {
12
12
  constructor(environmentName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magek/common",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Contains Magek common helpers used by the core and provider packages",
5
5
  "keywords": [
6
6
  "framework-common-helpers"
@@ -33,7 +33,7 @@
33
33
  "uuid": "^13.0.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@magek/eslint-config": "^0.0.1",
36
+ "@magek/eslint-config": "^0.0.2",
37
37
  "@types/chai": "5.2.3",
38
38
  "@types/chai-as-promised": "8.0.2",
39
39
  "@types/mocha": "10.0.10",
@@ -1,12 +0,0 @@
1
- export declare const DEFAULT_CHUNK_SIZE = 100;
2
- export interface AzureConfiguration {
3
- enableEventBatching: boolean;
4
- cosmos: {
5
- batchSize: number;
6
- requestOptions?: {
7
- consistencyLevel?: 'Strong' | 'BoundedStaleness' | 'Session' | 'Eventual' | 'ConsistentPrefix';
8
- disableRUPerMinuteUsage?: boolean;
9
- indexingDirective?: 'Include' | 'Exclude';
10
- };
11
- };
12
- }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_CHUNK_SIZE = void 0;
4
- exports.DEFAULT_CHUNK_SIZE = 100;
@@ -1,7 +0,0 @@
1
- import { RocketDescriptor } from './rockets';
2
- export declare class RocketLoader {
3
- private static requireRocket;
4
- static loadRocket(rocketDescriptor: RocketDescriptor): {
5
- mountStack: Function;
6
- };
7
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RocketLoader = void 0;
4
- class RocketLoader {
5
- // Separate function to make it easier to mock in tests
6
- static requireRocket(rocketPackageName) {
7
- return require(rocketPackageName).default;
8
- }
9
- static loadRocket(rocketDescriptor) {
10
- const rocketBuilder = RocketLoader.requireRocket(rocketDescriptor.packageName);
11
- if (!rocketBuilder)
12
- throw new Error(`Could not load the rocket infrastructure package ${rocketDescriptor.packageName}. Make sure you installed it in your project devDependencies.`);
13
- if (typeof rocketBuilder !== 'function')
14
- throw new Error(`Could not initialize rocket infrastructure package ${rocketDescriptor.packageName}. It doesn't seem to implement a rocket builder method as default export.`);
15
- const rocket = rocketBuilder(rocketDescriptor.parameters);
16
- if (!(rocket === null || rocket === void 0 ? void 0 : rocket.mountStack))
17
- throw new Error(`The package ${rocketDescriptor.packageName} doesn't seem to be a rocket.`);
18
- return rocket;
19
- }
20
- }
21
- exports.RocketLoader = RocketLoader;
package/dist/rockets.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import { MagekConfig } from './config';
2
- export declare const rocketFunctionIDEnvVar = "ROCKET_FUNCTION_ID";
3
- export type RocketFunction = (config: MagekConfig, request: unknown) => Promise<unknown>;
4
- export interface RocketDescriptor {
5
- packageName: string;
6
- parameters: unknown;
7
- }
8
- export interface RocketEnvelope {
9
- rocketId: string | undefined;
10
- }
package/dist/rockets.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rocketFunctionIDEnvVar = void 0;
4
- exports.rocketFunctionIDEnvVar = 'ROCKET_FUNCTION_ID';