@common-stack/core 6.0.8-alpha.7 → 8.0.1-alpha.0

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.
@@ -36,4 +36,10 @@ export interface IViteSettings {
36
36
  };
37
37
  excludeRoutes?: string[];
38
38
  };
39
+ /**
40
+ * @name _useFutureCommonPackage Configuration
41
+ * @description Whether the package is using common package or not
42
+ * @default: false
43
+ */
44
+ _useFutureCommonPackage?: boolean;
39
45
  }
@@ -40,7 +40,7 @@ export interface IResourceParams {
40
40
  path?: string;
41
41
  isExternal?: boolean;
42
42
  organization?: string;
43
- projectId?: string;
43
+ resourceGroup?: string;
44
44
  resourceType?: string;
45
45
  resourceId?: string;
46
46
  }
@@ -130,5 +130,11 @@ export interface IGeneratedWrapperOptions {
130
130
  * @description Configuration for authority and permission checks.
131
131
  */
132
132
  authorityConfig?: IAuthorityConfig;
133
+ /**
134
+ * @name _useFutureCommonPackage Configuration
135
+ * @description Whether the package is using common package or not
136
+ * @default: false
137
+ */
138
+ _useFutureCommonPackage?: boolean;
133
139
  }
134
140
  export type IWrapperOptions = IWrapperBuildOptions & IRollupBuildGenerated & IGeneratedWrapperOptions;
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export{FieldError}from'./field-error.js';export{ClientTypes,CommonType,ElectronTypes,TaggedType}from'./constants/types.js';export{getEnvironment}from'./utils/getEnvironment.js';//# sourceMappingURL=index.js.map
1
+ export{FieldError}from'./field-error.js';export{ClientTypes,CommonType,ElectronTypes,TaggedType}from'./constants/types.js';export{getEnvironment}from'./utils/getEnvironment.js';export{getGlobalVariable,setGlobalVariable}from'./utils/globalVariable.js';//# sourceMappingURL=index.js.map
@@ -1 +1,2 @@
1
1
  export * from './common-settings';
2
+ export * from './redis';
@@ -0,0 +1,11 @@
1
+ export interface Redis {
2
+ get?(key: string): Promise<string | null>;
3
+ get?(key: string, callback?: (...args: any[]) => void): any;
4
+ set(key: string, value: string, options?: {
5
+ ex?: number;
6
+ }): Promise<string>;
7
+ del(key: string): Promise<number>;
8
+ delMulti(keys: string[]): Promise<any>;
9
+ on?(event: string | symbol, callback: (...args: any[]) => void): any;
10
+ once?(event: string | symbol, callback: (...args: any[]) => void): any;
11
+ }
@@ -0,0 +1,2 @@
1
+ export * from './ioredis';
2
+ export * from './upstash-redis';
@@ -0,0 +1 @@
1
+ export{IORedisClient}from'./ioredis.js';export{UpstashRedisClient}from'./upstash-redis.js';//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import Redis from 'ioredis';
2
+ import { Redis as RedisClient } from '../interfaces/redis';
3
+ export declare class IORedisClient implements RedisClient {
4
+ private redis;
5
+ constructor(config: {
6
+ url: string;
7
+ });
8
+ get(key: string): Promise<any | null>;
9
+ set(key: string, value: string, options?: {
10
+ ex?: number;
11
+ }): Promise<string>;
12
+ delMulti(keys: string[]): Promise<any>;
13
+ del(key: string): Promise<number>;
14
+ on(event: string, cb: (...args: any[]) => void): Redis;
15
+ }
@@ -0,0 +1,27 @@
1
+ import Redis from'ioredis';class IORedisClient {
2
+ redis;
3
+ constructor(config) {
4
+ this.redis = new Redis(config.url);
5
+ }
6
+ async get(key) {
7
+ const data = await this.redis.get(key);
8
+ return data;
9
+ }
10
+ async set(key, value, options) {
11
+ if (options?.ex) {
12
+ return await this.redis.set(key, value, 'EX', options?.ex);
13
+ }
14
+ else {
15
+ return await this.redis.set(key, value);
16
+ }
17
+ }
18
+ async delMulti(keys) {
19
+ return await this.redis.del(keys);
20
+ }
21
+ async del(key) {
22
+ return await this.redis.del(key);
23
+ }
24
+ on(event, cb) {
25
+ return this.redis.on(event, cb);
26
+ }
27
+ }export{IORedisClient};//# sourceMappingURL=ioredis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ioredis.js","sources":["../../src/redis-client/ioredis.ts"],"sourcesContent":[null],"names":[],"mappings":"iCAGa,aAAa,CAAA;AACd,IAAA,KAAK,CAAQ;AAErB,IAAA,WAAA,CAAY,MAAuB,EAAA;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KACtC;IAED,MAAM,GAAG,CAAC,GAAW,EAAA;QACjB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACvC,QAAA,OAAO,IAAI,CAAC;KACf;AAED,IAAA,MAAM,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,OAAyB,EAAA;AAC3D,QAAA,IAAI,OAAO,EAAE,EAAE,EAAE;AACb,YAAA,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;SAC9D;aAAM;YACH,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAC3C;KACJ;IAED,MAAM,QAAQ,CAAC,IAAc,EAAA;QACzB,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KACrC;IAED,MAAM,GAAG,CAAC,GAAW,EAAA;QACjB,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACpC;IAED,EAAE,CAAC,KAAa,EAAE,EAA4B,EAAA;QAC1C,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;KACnC;AACJ"}
@@ -0,0 +1,14 @@
1
+ import { Redis as RedisClient } from '../interfaces/redis';
2
+ export declare class UpstashRedisClient implements RedisClient {
3
+ private redis;
4
+ constructor(config: {
5
+ url: string;
6
+ token?: string;
7
+ });
8
+ get(key: string): Promise<any | null>;
9
+ set(key: string, value: string, options?: {
10
+ ex?: number;
11
+ }): Promise<string>;
12
+ delMulti(keys: string[]): Promise<any>;
13
+ del(key: string): Promise<number>;
14
+ }
@@ -0,0 +1,23 @@
1
+ import {Redis}from'@upstash/redis/cloudflare';class UpstashRedisClient {
2
+ redis;
3
+ constructor(config) {
4
+ this.redis = new Redis({ url: config.url, token: config.token });
5
+ }
6
+ async get(key) {
7
+ return await this.redis.get(key);
8
+ }
9
+ async set(key, value, options) {
10
+ if (options?.ex) {
11
+ return await this.redis.set(key, value, { ex: options?.ex });
12
+ }
13
+ else {
14
+ return await this.redis.set(key, value);
15
+ }
16
+ }
17
+ async delMulti(keys) {
18
+ return await Promise.all(keys.map((key) => this.redis.del(key)));
19
+ }
20
+ async del(key) {
21
+ return await this.redis.del(key);
22
+ }
23
+ }export{UpstashRedisClient};//# sourceMappingURL=upstash-redis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstash-redis.js","sources":["../../src/redis-client/upstash-redis.ts"],"sourcesContent":[null],"names":[],"mappings":"oDAGa,kBAAkB,CAAA;AACnB,IAAA,KAAK,CAAQ;AAErB,IAAA,WAAA,CAAY,MAAuC,EAAA;QAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;KACpE;IAED,MAAM,GAAG,CAAC,GAAW,EAAA;QACjB,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACpC;AAED,IAAA,MAAM,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,OAAyB,EAAA;AAC3D,QAAA,IAAI,OAAO,EAAE,EAAE,EAAE;AACb,YAAA,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;SAChE;aAAM;YACH,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAC3C;KACJ;IAED,MAAM,QAAQ,CAAC,IAAc,EAAA;QACzB,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACpE;IAED,MAAM,GAAG,CAAC,GAAW,EAAA;QACjB,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACpC;AACJ"}
@@ -0,0 +1,2 @@
1
+ export declare const getGlobalVariable: (key: any, _default?: any) => any;
2
+ export declare const setGlobalVariable: (key: any, value: any) => void;
@@ -0,0 +1,17 @@
1
+ import'envalid';/* eslint-disable no-nested-ternary */
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ /* define functions to set/get underscore variables */
4
+ // @ts-ignore
5
+ const getGlobals = () => typeof window !== 'undefined' ? window : process.env.SERVER_ENV === 'cloudflare' ? process.env : global;
6
+ const getGlobalVariable = (key, _default = undefined) => {
7
+ const globals = getGlobals();
8
+ if (globals.hasOwnProperty(key)) {
9
+ const value = globals[key];
10
+ return value === 'true' ? true : value === 'false' ? false : value;
11
+ }
12
+ return _default;
13
+ };
14
+ const setGlobalVariable = (key, value) => {
15
+ const globals = getGlobals();
16
+ globals[key] = value;
17
+ };export{getGlobalVariable,setGlobalVariable};//# sourceMappingURL=globalVariable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globalVariable.js","sources":["../../src/utils/globalVariable.ts"],"sourcesContent":[null],"names":[],"mappings":"gBAAA;AACA;AAIA;AAEA;AACA,MAAM,UAAU,GAAG,MACf,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,YAAY,GAAG,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC;AAE/F,MAAA,iBAAiB,GAAG,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS,KAAI;AAC3D,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,IAAI,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;AAC7B,QAAA,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,OAAO,KAAK,KAAK,MAAM,GAAG,IAAI,GAAG,KAAK,KAAK,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;KACtE;AACD,IAAA,OAAO,QAAQ,CAAC;AACpB,EAAE;MAEW,iBAAiB,GAAG,CAAC,GAAG,EAAE,KAAK,KAAI;AAC5C,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACzB"}
@@ -1 +1,2 @@
1
1
  export * from './getEnvironment';
2
+ export * from './globalVariable';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common-stack/core",
3
- "version": "6.0.8-alpha.7",
3
+ "version": "8.0.1-alpha.0",
4
4
  "description": "Common core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -23,8 +23,8 @@
23
23
  "publishConfig": {
24
24
  "access": "public"
25
25
  },
26
- "gitHead": "6fb0dbf3e838663c8524b0746a11322b30490268",
27
26
  "typescript": {
28
27
  "definition": "lib/index.d.ts"
29
- }
28
+ },
29
+ "gitHead": "73d9088ae254fbc43425eed5c9f5cd95bd66e921"
30
30
  }