@akanjs/base 0.0.39 → 0.0.40

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/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export { DataList, Enum, EnumType, enumOf, logo, version } from './src/base.js';
2
+ export { BackendEnv, BaseClientEnv, BaseEnv, Environment, baseClientEnv, baseEnv } from './src/baseEnv.js';
3
+ export { BaseObject, Float, GqlScalar, GqlScalarName, ID, Int, JSON, SingleFieldType, Upload, applyFnToArrayObjects, arraiedModel, dayjs, getNonArrayModel, gqlScalarNames, gqlScalars, isGqlClass, isGqlMap, isGqlScalar, scalarArgMap, scalarDefaultMap, scalarNameMap, scalarSet } from './src/scalar.js';
4
+ export { BufferLike, GetObject, GraphQLJSON, GraphQLUpload, OptionOf, Type, UnType } from './src/types.js';
5
+ export { Dayjs } from 'dayjs';
6
+ export { SshOptions } from 'tunnel-ssh';
7
+ import 'fs';
8
+ import 'stream';
package/index.js CHANGED
@@ -1,333 +1,21 @@
1
- (() => {
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
- }) : x)(function(x) {
11
- if (typeof require !== "undefined")
12
- return require.apply(this, arguments);
13
- throw Error('Dynamic require of "' + x + '" is not supported');
14
- });
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
-
32
- // pkgs/@akanjs/base/src/base.ts
33
- var Enum = class {
34
- constructor(values) {
35
- this.values = values;
36
- this.valueMap = new Map(values.map((value, idx) => [value, idx]));
37
- }
38
- value;
39
- // for type
40
- valueMap;
41
- has(value) {
42
- return this.valueMap.has(value);
43
- }
44
- indexOf(value) {
45
- const idx = this.valueMap.get(value);
46
- if (idx === void 0)
47
- throw new Error(`Value ${value} is not in enum`);
48
- return idx;
49
- }
50
- find(callback) {
51
- const val = this.values.find(callback);
52
- if (val === void 0)
53
- throw new Error(`Value not found in enum`);
54
- return val;
55
- }
56
- findIndex(callback) {
57
- const idx = this.values.findIndex(callback);
58
- if (idx === -1)
59
- throw new Error(`Value not found in enum`);
60
- return idx;
61
- }
62
- filter(callback) {
63
- return this.values.filter(callback);
64
- }
65
- map(callback) {
66
- return this.values.map(callback);
67
- }
68
- forEach(callback) {
69
- this.values.forEach(callback);
70
- }
71
- };
72
- var enumOf = (values) => new Enum(values);
73
- var DataList = class _DataList {
74
- // [immerable] = true;
75
- #idMap;
76
- length;
77
- values;
78
- constructor(data = []) {
79
- this.values = Array.isArray(data) ? [...data] : [...data.values];
80
- this.#idMap = new Map(this.values.map((value, idx) => [value.id, idx]));
81
- this.length = this.values.length;
82
- }
83
- indexOf(id) {
84
- const idx = this.#idMap.get(id);
85
- if (idx === void 0)
86
- throw new Error(`Value ${id} is not in list`);
87
- return idx;
88
- }
89
- set(value) {
90
- const idx = this.#idMap.get(value.id);
91
- if (idx !== void 0)
92
- this.values = [...this.values.slice(0, idx), value, ...this.values.slice(idx + 1)];
93
- else {
94
- this.#idMap.set(value.id, this.length);
95
- this.values = [...this.values, value];
96
- this.length++;
97
- }
98
- return this;
99
- }
100
- delete(id) {
101
- const idx = this.#idMap.get(id);
102
- if (idx === void 0)
103
- return this;
104
- this.#idMap.delete(id);
105
- this.values.splice(idx, 1);
106
- this.values.slice(idx).forEach((value, i) => this.#idMap.set(value.id, i + idx));
107
- this.length--;
108
- return this;
109
- }
110
- get(id) {
111
- const idx = this.#idMap.get(id);
112
- if (idx === void 0)
113
- return void 0;
114
- return this.values[idx];
115
- }
116
- at(idx) {
117
- return this.values.at(idx);
118
- }
119
- pickAt(idx) {
120
- const value = this.values.at(idx);
121
- if (value === void 0)
122
- throw new Error(`Value at ${idx} is undefined`);
123
- return value;
124
- }
125
- pick(id) {
126
- return this.values[this.indexOf(id)];
127
- }
128
- has(id) {
129
- return this.#idMap.has(id);
130
- }
131
- find(fn) {
132
- const val = this.values.find(fn);
133
- return val;
134
- }
135
- findIndex(fn) {
136
- const val = this.values.findIndex(fn);
137
- return val;
138
- }
139
- some(fn) {
140
- return this.values.some(fn);
141
- }
142
- every(fn) {
143
- return this.values.every(fn);
144
- }
145
- forEach(fn) {
146
- this.values.forEach(fn);
147
- }
148
- map(fn) {
149
- return this.values.map(fn);
150
- }
151
- flatMap(fn) {
152
- return this.values.flatMap(fn);
153
- }
154
- sort(fn) {
155
- return new _DataList(this.values.sort(fn));
156
- }
157
- filter(fn) {
158
- return new _DataList(this.values.filter(fn));
159
- }
160
- reduce(fn, initialValue) {
161
- return this.values.reduce(fn, initialValue);
162
- }
163
- slice(start, end = this.length) {
164
- return new _DataList(this.values.slice(start, end));
165
- }
166
- save() {
167
- return new _DataList(this);
168
- }
169
- [Symbol.iterator]() {
170
- return this.values[Symbol.iterator]();
171
- }
172
- };
173
- var version = "0.9.0";
174
- var logo = `
175
- _ _ _
176
- / \\ | | ____ _ _ __ (_)___
177
- / _ \\ | |/ / _' | '_ \\ | / __|
178
- / ___ \\| < (_| | | | |_ | \\__ \\
179
- /_/ \\_\\_|\\_\\__,_|_| |_(_)/ |___/
180
- |__/ ver ${version}
181
- ? See more details on docs https://www.akanjs.com/docs
182
- \u2605 Star Akanjs on GitHub https://github.com/aka-bassman/akanjs
183
-
184
- `;
185
-
186
- // pkgs/@akanjs/base/src/baseEnv.ts
187
- var appName = process.env.NEXT_PUBLIC_APP_NAME ?? "unknown";
188
- var repoName = process.env.NEXT_PUBLIC_REPO_NAME ?? "unknown";
189
- var serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "unknown";
190
- if (appName === "unknown")
191
- throw new Error("environment variable NEXT_PUBLIC_APP_NAME is required");
192
- if (repoName === "unknown")
193
- throw new Error("environment variable NEXT_PUBLIC_REPO_NAME is required");
194
- if (serveDomain === "unknown")
195
- throw new Error("environment variable NEXT_PUBLIC_SERVE_DOMAIN is required");
196
- var environment = process.env.NEXT_PUBLIC_ENV ?? "debug";
197
- var operationType = typeof window !== "undefined" ? "client" : process.env.NEXT_RUNTIME ? "client" : "server";
198
- var operationMode = process.env.NEXT_PUBLIC_OPERATION_MODE ?? "cloud";
199
- var networkType = process.env.NEXT_PUBLIC_NETWORK_TYPE ?? (environment === "main" ? "mainnet" : environment === "develop" ? "testnet" : "debugnet");
200
- var tunnelUsername = process.env.SSU_TUNNEL_USERNAME ?? "root";
201
- var tunnelPassword = process.env.SSU_TUNNEL_PASSWORD ?? repoName;
202
- var baseEnv = {
203
- repoName,
204
- serveDomain,
205
- appName,
206
- environment,
207
- operationType,
208
- operationMode,
209
- networkType,
210
- tunnelUsername,
211
- tunnelPassword
212
- };
213
- var side = typeof window === "undefined" ? "server" : "client";
214
- var renderMode = process.env.RENDER_ENV ?? "ssr";
215
- var clientHost = process.env.NEXT_PUBLIC_CLIENT_HOST ?? (operationMode === "local" || side === "server" ? "localhost" : window.location.hostname);
216
- var clientPort = parseInt(
217
- process.env.NEXT_PUBLIC_CLIENT_PORT ?? (operationMode === "local" ? renderMode === "ssr" ? "4200" : "4201" : "443")
218
- );
219
- var clientHttpProtocol = side === "client" ? window.location.protocol : clientHost === "localhost" ? "http:" : "https:";
220
- var clientHttpUri = `${clientHttpProtocol}//${clientHost}${clientPort === 443 ? "" : `:${clientPort}`}`;
221
- var serverHost = process.env.SERVER_HOST ?? (operationMode === "local" ? typeof window === "undefined" ? "localhost" : window.location.host.split(":")[0] : renderMode === "csr" ? `${appName}-${environment}.${serveDomain}` : side === "client" ? window.location.host.split(":")[0] : operationMode === "cloud" ? `backend-svc.${appName}-${environment}.svc.cluster.local` : "localhost");
222
- var serverPort = parseInt(
223
- process.env.SERVER_PORT ?? (operationMode === "local" || side === "server" ? "8080" : "443")
224
- );
225
- var serverHttpProtocol = side === "client" ? window.location.protocol : "http:";
226
- var serverHttpUri = `${serverHttpProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}/backend`;
227
- var serverGraphqlUri = `${serverHttpUri}/graphql`;
228
- var serverWsProtocol = serverHttpProtocol === "http:" ? "ws:" : "wss:";
229
- var serverWsUri = `${serverWsProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}`;
230
- var baseClientEnv = {
231
- ...baseEnv,
232
- side,
233
- renderMode,
234
- websocket: true,
235
- clientHost,
236
- clientPort,
237
- clientHttpProtocol,
238
- clientHttpUri,
239
- serverHost,
240
- serverPort,
241
- serverHttpProtocol,
242
- serverHttpUri,
243
- serverGraphqlUri,
244
- serverWsProtocol,
245
- serverWsUri
246
- };
247
-
248
- // pkgs/@akanjs/base/src/scalar.ts
249
- var import_dayjs = __toESM(__require("dayjs"));
250
- var dayjs = import_dayjs.default;
251
- var BaseObject = class {
252
- id;
253
- createdAt;
254
- updatedAt;
255
- removedAt;
256
- };
257
- var Int = class {
258
- __Scalar__;
259
- };
260
- var Upload = class {
261
- __Scalar__;
262
- filename;
263
- mimetype;
264
- encoding;
265
- createReadStream;
266
- };
267
- var Float = class {
268
- __Scalar__;
269
- };
270
- var ID = class {
271
- __Scalar__;
272
- };
273
- var JSON = class {
274
- __Scalar__;
275
- };
276
- var getNonArrayModel = (arraiedModel2) => {
277
- let arrDepth = 0;
278
- let target = arraiedModel2;
279
- while (Array.isArray(target)) {
280
- target = target[0];
281
- arrDepth++;
282
- }
283
- return [target, arrDepth];
284
- };
285
- var arraiedModel = (modelRef, arrDepth = 0) => {
286
- let target = modelRef;
287
- for (let i = 0; i < arrDepth; i++)
288
- target = [target];
289
- return target;
290
- };
291
- var applyFnToArrayObjects = (arraiedData, fn) => {
292
- if (Array.isArray(arraiedData))
293
- return arraiedData.map((data) => applyFnToArrayObjects(data, fn));
294
- return fn(arraiedData);
295
- };
296
- var gqlScalars = [String, Boolean, Date, ID, Int, Float, Upload, JSON, Map];
297
- var gqlScalarNames = ["ID", "Int", "Float", "String", "Boolean", "Date", "Upload", "JSON", "Map"];
298
- var scalarSet = /* @__PURE__ */ new Set([String, Boolean, Date, ID, Int, Float, Upload, JSON, Map]);
299
- var scalarNameMap = /* @__PURE__ */ new Map([
300
- [ID, "ID"],
301
- [Int, "Int"],
302
- [Float, "Float"],
303
- [String, "String"],
304
- [Boolean, "Boolean"],
305
- [Date, "Date"],
306
- [Upload, "Upload"],
307
- [JSON, "JSON"],
308
- [Map, "Map"]
309
- ]);
310
- var scalarArgMap = /* @__PURE__ */ new Map([
311
- [ID, null],
312
- [String, ""],
313
- [Boolean, false],
314
- [Date, dayjs(/* @__PURE__ */ new Date(-1))],
315
- [Int, 0],
316
- [Float, 0],
317
- [JSON, {}],
318
- [Map, {}]
319
- ]);
320
- var scalarDefaultMap = /* @__PURE__ */ new Map([
321
- [ID, null],
322
- [String, ""],
323
- [Boolean, false],
324
- [Date, dayjs(/* @__PURE__ */ new Date(-1))],
325
- [Int, 0],
326
- [Float, 0],
327
- [JSON, {}]
328
- ]);
329
- var isGqlClass = (modelRef) => !scalarSet.has(modelRef);
330
- var isGqlScalar = (modelRef) => scalarSet.has(modelRef);
331
- var isGqlMap = (modelRef) => modelRef === Map;
332
- })();
333
- //! Nextjs는 환경변수를 build time에 그냥 하드코딩으로 값을 넣어버림. operationMode같은것들 잘 동작안할 수 있음. 추후 수정 필요.
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var index_exports = {};
16
+ module.exports = __toCommonJS(index_exports);
17
+ __reExport(index_exports, require("./src"), module.exports);
18
+ // Annotate the CommonJS export names for ESM import in node:
19
+ 0 && (module.exports = {
20
+ ...require("./src")
21
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/base",
3
- "version": "0.0.39",
3
+ "version": "0.0.40",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,7 +14,5 @@
14
14
  "engines": {
15
15
  "node": ">=22"
16
16
  },
17
- "dependencies": {
18
- "dayjs": "^1.11.13"
19
- }
17
+ "dependencies": {}
20
18
  }
package/src/base.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ declare class Enum<T> {
2
+ readonly values: T[];
3
+ readonly value: T;
4
+ readonly valueMap: Map<T, number>;
5
+ constructor(values: T[]);
6
+ has(value: T): boolean;
7
+ indexOf(value: T): number;
8
+ find(callback: (value: T, index: number, array: T[]) => boolean): T;
9
+ findIndex(callback: (value: T, index: number, array: T[]) => boolean): number;
10
+ filter(callback: (value: T, index: number, array: T[]) => boolean): T[];
11
+ map<R>(callback: (value: T, index: number, array: T[]) => R): R[];
12
+ forEach(callback: (value: T, index: number, array: T[]) => void): void;
13
+ }
14
+ declare const enumOf: <T>(values: T[]) => Enum<T>;
15
+ type enumOf<E> = E extends Enum<infer T> ? T : never;
16
+ type EnumType<E> = E extends Enum<infer T> ? T : never;
17
+ declare class DataList<Light extends {
18
+ id: string;
19
+ }> {
20
+ #private;
21
+ length: number;
22
+ values: Light[];
23
+ constructor(data?: Light[] | DataList<Light>);
24
+ indexOf(id: string): number;
25
+ set(value: Light): this;
26
+ delete(id: string): this;
27
+ get(id: string): Light | undefined;
28
+ at(idx: number): Light | undefined;
29
+ pickAt(idx: number): Light;
30
+ pick(id: string): Light;
31
+ has(id: string): boolean;
32
+ find(fn: (value: Light, idx: number) => boolean): Light | undefined;
33
+ findIndex(fn: (value: Light, idx: number) => boolean): number;
34
+ some(fn: (value: Light, idx: number) => boolean): boolean;
35
+ every(fn: (value: Light, idx: number) => boolean): boolean;
36
+ forEach(fn: (value: Light, idx: number) => void): void;
37
+ map<T>(fn: (value: Light, idx: number) => T): T[];
38
+ flatMap<T>(fn: (value: Light, idx: number, array: Light[]) => T | readonly T[]): T[];
39
+ sort(fn: (a: Light, b: Light) => number): DataList<Light>;
40
+ filter(fn: (value: Light, idx: number) => boolean): DataList<Light>;
41
+ reduce<T>(fn: (acc: T, value: Light, idx: number) => T, initialValue: T): T;
42
+ slice(start: number, end?: number): DataList<Light>;
43
+ save(): DataList<Light>;
44
+ [Symbol.iterator](): ArrayIterator<Light>;
45
+ }
46
+ declare const version = "0.9.0";
47
+ declare const logo = "\n _ _ _ \n / \\ | | ____ _ _ __ (_)___ \n / _ \\ | |/ / _' | '_ \\ | / __|\n / ___ \\| < (_| | | | |_ | \\__ \\\n /_/ \\_\\_|\\_\\__,_|_| |_(_)/ |___/\n |__/ ver 0.9.0\n? See more details on docs https://www.akanjs.com/docs\n\u2605 Star Akanjs on GitHub https://github.com/aka-bassman/akanjs\n\n";
48
+
49
+ export { DataList, Enum, type EnumType, enumOf, logo, version };
package/src/base.js ADDED
@@ -0,0 +1,202 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var base_exports = {};
20
+ __export(base_exports, {
21
+ DataList: () => DataList,
22
+ Enum: () => Enum,
23
+ enumOf: () => enumOf,
24
+ logo: () => logo,
25
+ version: () => version
26
+ });
27
+ module.exports = __toCommonJS(base_exports);
28
+ class Enum {
29
+ static {
30
+ __name(this, "Enum");
31
+ }
32
+ values;
33
+ value;
34
+ valueMap;
35
+ constructor(values) {
36
+ this.values = values;
37
+ this.valueMap = new Map(values.map((value, idx) => [
38
+ value,
39
+ idx
40
+ ]));
41
+ }
42
+ has(value) {
43
+ return this.valueMap.has(value);
44
+ }
45
+ indexOf(value) {
46
+ const idx = this.valueMap.get(value);
47
+ if (idx === void 0) throw new Error(`Value ${value} is not in enum`);
48
+ return idx;
49
+ }
50
+ find(callback) {
51
+ const val = this.values.find(callback);
52
+ if (val === void 0) throw new Error(`Value not found in enum`);
53
+ return val;
54
+ }
55
+ findIndex(callback) {
56
+ const idx = this.values.findIndex(callback);
57
+ if (idx === -1) throw new Error(`Value not found in enum`);
58
+ return idx;
59
+ }
60
+ filter(callback) {
61
+ return this.values.filter(callback);
62
+ }
63
+ map(callback) {
64
+ return this.values.map(callback);
65
+ }
66
+ forEach(callback) {
67
+ this.values.forEach(callback);
68
+ }
69
+ }
70
+ const enumOf = /* @__PURE__ */ __name((values) => new Enum(values), "enumOf");
71
+ class DataList {
72
+ static {
73
+ __name(this, "DataList");
74
+ }
75
+ // [immerable] = true;
76
+ #idMap;
77
+ length;
78
+ values;
79
+ constructor(data = []) {
80
+ this.values = Array.isArray(data) ? [
81
+ ...data
82
+ ] : [
83
+ ...data.values
84
+ ];
85
+ this.#idMap = new Map(this.values.map((value, idx) => [
86
+ value.id,
87
+ idx
88
+ ]));
89
+ this.length = this.values.length;
90
+ }
91
+ indexOf(id) {
92
+ const idx = this.#idMap.get(id);
93
+ if (idx === void 0) throw new Error(`Value ${id} is not in list`);
94
+ return idx;
95
+ }
96
+ set(value) {
97
+ const idx = this.#idMap.get(value.id);
98
+ if (idx !== void 0) this.values = [
99
+ ...this.values.slice(0, idx),
100
+ value,
101
+ ...this.values.slice(idx + 1)
102
+ ];
103
+ else {
104
+ this.#idMap.set(value.id, this.length);
105
+ this.values = [
106
+ ...this.values,
107
+ value
108
+ ];
109
+ this.length++;
110
+ }
111
+ return this;
112
+ }
113
+ delete(id) {
114
+ const idx = this.#idMap.get(id);
115
+ if (idx === void 0) return this;
116
+ this.#idMap.delete(id);
117
+ this.values.splice(idx, 1);
118
+ this.values.slice(idx).forEach((value, i) => this.#idMap.set(value.id, i + idx));
119
+ this.length--;
120
+ return this;
121
+ }
122
+ get(id) {
123
+ const idx = this.#idMap.get(id);
124
+ if (idx === void 0) return void 0;
125
+ return this.values[idx];
126
+ }
127
+ at(idx) {
128
+ return this.values.at(idx);
129
+ }
130
+ pickAt(idx) {
131
+ const value = this.values.at(idx);
132
+ if (value === void 0) throw new Error(`Value at ${idx} is undefined`);
133
+ return value;
134
+ }
135
+ pick(id) {
136
+ return this.values[this.indexOf(id)];
137
+ }
138
+ has(id) {
139
+ return this.#idMap.has(id);
140
+ }
141
+ find(fn) {
142
+ const val = this.values.find(fn);
143
+ return val;
144
+ }
145
+ findIndex(fn) {
146
+ const val = this.values.findIndex(fn);
147
+ return val;
148
+ }
149
+ some(fn) {
150
+ return this.values.some(fn);
151
+ }
152
+ every(fn) {
153
+ return this.values.every(fn);
154
+ }
155
+ forEach(fn) {
156
+ this.values.forEach(fn);
157
+ }
158
+ map(fn) {
159
+ return this.values.map(fn);
160
+ }
161
+ flatMap(fn) {
162
+ return this.values.flatMap(fn);
163
+ }
164
+ sort(fn) {
165
+ return new DataList(this.values.sort(fn));
166
+ }
167
+ filter(fn) {
168
+ return new DataList(this.values.filter(fn));
169
+ }
170
+ reduce(fn, initialValue) {
171
+ return this.values.reduce(fn, initialValue);
172
+ }
173
+ slice(start, end = this.length) {
174
+ return new DataList(this.values.slice(start, end));
175
+ }
176
+ save() {
177
+ return new DataList(this);
178
+ }
179
+ [Symbol.iterator]() {
180
+ return this.values[Symbol.iterator]();
181
+ }
182
+ }
183
+ const version = "0.9.0";
184
+ const logo = `
185
+ _ _ _
186
+ / \\ | | ____ _ _ __ (_)___
187
+ / _ \\ | |/ / _' | '_ \\ | / __|
188
+ / ___ \\| < (_| | | | |_ | \\__ \\
189
+ /_/ \\_\\_|\\_\\__,_|_| |_(_)/ |___/
190
+ |__/ ver ${version}
191
+ ? See more details on docs https://www.akanjs.com/docs
192
+ \u2605 Star Akanjs on GitHub https://github.com/aka-bassman/akanjs
193
+
194
+ `;
195
+ // Annotate the CommonJS export names for ESM import in node:
196
+ 0 && (module.exports = {
197
+ DataList,
198
+ Enum,
199
+ enumOf,
200
+ logo,
201
+ version
202
+ });
@@ -0,0 +1,51 @@
1
+ import { SshOptions } from 'tunnel-ssh';
2
+
3
+ type Environment = "testing" | "debug" | "develop" | "main";
4
+ interface BaseEnv {
5
+ repoName: string;
6
+ serveDomain: string;
7
+ appName: string;
8
+ environment: Environment;
9
+ operationType: "server" | "client";
10
+ operationMode: "local" | "edge" | "cloud" | "module";
11
+ networkType: "mainnet" | "testnet" | "debugnet";
12
+ tunnelUsername: string;
13
+ tunnelPassword: string;
14
+ }
15
+ type BackendEnv = BaseEnv & {
16
+ hostname: string | null;
17
+ appCode: number;
18
+ mongo: {
19
+ username?: string;
20
+ password?: string;
21
+ sshOptions?: SshOptions;
22
+ };
23
+ redis?: {
24
+ sshOptions?: SshOptions;
25
+ };
26
+ port?: number;
27
+ mongoUri?: string;
28
+ redisUri?: string;
29
+ meiliUri?: string;
30
+ onCleanup?: () => Promise<void>;
31
+ };
32
+ declare const baseEnv: BaseEnv;
33
+ type BaseClientEnv = BaseEnv & {
34
+ side: "server" | "client";
35
+ renderMode: "ssr" | "csr";
36
+ websocket: boolean;
37
+ clientHost: string;
38
+ clientPort: number;
39
+ clientHttpProtocol: "http:" | "https:";
40
+ clientHttpUri: string;
41
+ serverHost: string;
42
+ serverPort: number;
43
+ serverHttpProtocol: "http:" | "https:";
44
+ serverHttpUri: string;
45
+ serverGraphqlUri: string;
46
+ serverWsProtocol: "ws:" | "wss:";
47
+ serverWsUri: string;
48
+ };
49
+ declare const baseClientEnv: BaseClientEnv;
50
+
51
+ export { type BackendEnv, type BaseClientEnv, type BaseEnv, type Environment, baseClientEnv, baseEnv };
package/src/baseEnv.js ADDED
@@ -0,0 +1,82 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var baseEnv_exports = {};
19
+ __export(baseEnv_exports, {
20
+ baseClientEnv: () => baseClientEnv,
21
+ baseEnv: () => baseEnv
22
+ });
23
+ module.exports = __toCommonJS(baseEnv_exports);
24
+ //! Nextjs는 환경변수를 build time에 그냥 하드코딩으로 값을 넣어버림. operationMode같은것들 잘 동작안할 수 있음. 추후 수정 필요.
25
+ const appName = process.env.NEXT_PUBLIC_APP_NAME ?? "unknown";
26
+ const repoName = process.env.NEXT_PUBLIC_REPO_NAME ?? "unknown";
27
+ const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "unknown";
28
+ if (appName === "unknown") throw new Error("environment variable NEXT_PUBLIC_APP_NAME is required");
29
+ if (repoName === "unknown") throw new Error("environment variable NEXT_PUBLIC_REPO_NAME is required");
30
+ if (serveDomain === "unknown") throw new Error("environment variable NEXT_PUBLIC_SERVE_DOMAIN is required");
31
+ const environment = process.env.NEXT_PUBLIC_ENV ?? "debug";
32
+ const operationType = typeof window !== "undefined" ? "client" : process.env.NEXT_RUNTIME ? "client" : "server";
33
+ const operationMode = process.env.NEXT_PUBLIC_OPERATION_MODE ?? "cloud";
34
+ const networkType = process.env.NEXT_PUBLIC_NETWORK_TYPE ?? (environment === "main" ? "mainnet" : environment === "develop" ? "testnet" : "debugnet");
35
+ const tunnelUsername = process.env.SSU_TUNNEL_USERNAME ?? "root";
36
+ const tunnelPassword = process.env.SSU_TUNNEL_PASSWORD ?? repoName;
37
+ const baseEnv = {
38
+ repoName,
39
+ serveDomain,
40
+ appName,
41
+ environment,
42
+ operationType,
43
+ operationMode,
44
+ networkType,
45
+ tunnelUsername,
46
+ tunnelPassword
47
+ };
48
+ const side = typeof window === "undefined" ? "server" : "client";
49
+ const renderMode = process.env.RENDER_ENV ?? "ssr";
50
+ const clientHost = process.env.NEXT_PUBLIC_CLIENT_HOST ?? (operationMode === "local" || side === "server" ? "localhost" : window.location.hostname);
51
+ const clientPort = parseInt(process.env.NEXT_PUBLIC_CLIENT_PORT ?? (operationMode === "local" ? renderMode === "ssr" ? "4200" : "4201" : "443"));
52
+ const clientHttpProtocol = side === "client" ? window.location.protocol : clientHost === "localhost" ? "http:" : "https:";
53
+ const clientHttpUri = `${clientHttpProtocol}//${clientHost}${clientPort === 443 ? "" : `:${clientPort}`}`;
54
+ const serverHost = process.env.SERVER_HOST ?? (operationMode === "local" ? typeof window === "undefined" ? "localhost" : window.location.host.split(":")[0] : renderMode === "csr" ? `${appName}-${environment}.${serveDomain}` : side === "client" ? window.location.host.split(":")[0] : operationMode === "cloud" ? `backend-svc.${appName}-${environment}.svc.cluster.local` : "localhost");
55
+ const serverPort = parseInt(process.env.SERVER_PORT ?? (operationMode === "local" || side === "server" ? "8080" : "443"));
56
+ const serverHttpProtocol = side === "client" ? window.location.protocol : "http:";
57
+ const serverHttpUri = `${serverHttpProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}/backend`;
58
+ const serverGraphqlUri = `${serverHttpUri}/graphql`;
59
+ const serverWsProtocol = serverHttpProtocol === "http:" ? "ws:" : "wss:";
60
+ const serverWsUri = `${serverWsProtocol}//${serverHost}${serverPort === 443 ? "" : `:${serverPort}`}`;
61
+ const baseClientEnv = {
62
+ ...baseEnv,
63
+ side,
64
+ renderMode,
65
+ websocket: true,
66
+ clientHost,
67
+ clientPort,
68
+ clientHttpProtocol,
69
+ clientHttpUri,
70
+ serverHost,
71
+ serverPort,
72
+ serverHttpProtocol,
73
+ serverHttpUri,
74
+ serverGraphqlUri,
75
+ serverWsProtocol,
76
+ serverWsUri
77
+ };
78
+ // Annotate the CommonJS export names for ESM import in node:
79
+ 0 && (module.exports = {
80
+ baseClientEnv,
81
+ baseEnv
82
+ });
package/src/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export { DataList, Enum, EnumType, enumOf, logo, version } from './base.js';
2
+ export { BackendEnv, BaseClientEnv, BaseEnv, Environment, baseClientEnv, baseEnv } from './baseEnv.js';
3
+ export { BaseObject, Float, GqlScalar, GqlScalarName, ID, Int, JSON, SingleFieldType, Upload, applyFnToArrayObjects, arraiedModel, dayjs, getNonArrayModel, gqlScalarNames, gqlScalars, isGqlClass, isGqlMap, isGqlScalar, scalarArgMap, scalarDefaultMap, scalarNameMap, scalarSet } from './scalar.js';
4
+ export { BufferLike, GetObject, GraphQLJSON, GraphQLUpload, OptionOf, Type, UnType } from './types.js';
5
+ export { Dayjs } from 'dayjs';
6
+ export { SshOptions } from 'tunnel-ssh';
7
+ import 'fs';
8
+ import 'stream';
package/src/index.js ADDED
@@ -0,0 +1,27 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var src_exports = {};
16
+ module.exports = __toCommonJS(src_exports);
17
+ __reExport(src_exports, require("./base"), module.exports);
18
+ __reExport(src_exports, require("./baseEnv"), module.exports);
19
+ __reExport(src_exports, require("./scalar"), module.exports);
20
+ __reExport(src_exports, require("./types"), module.exports);
21
+ // Annotate the CommonJS export names for ESM import in node:
22
+ 0 && (module.exports = {
23
+ ...require("./base"),
24
+ ...require("./baseEnv"),
25
+ ...require("./scalar"),
26
+ ...require("./types")
27
+ });
@@ -0,0 +1,50 @@
1
+ import dayjsLib, { Dayjs } from 'dayjs';
2
+ export { Dayjs } from 'dayjs';
3
+ import { ReadStream } from 'fs';
4
+ import { Readable } from 'stream';
5
+ import { Type, GraphQLJSON, GraphQLUpload } from './types.js';
6
+ import 'tunnel-ssh';
7
+
8
+ declare const dayjs: typeof dayjsLib;
9
+ declare class BaseObject {
10
+ id: string;
11
+ createdAt: Dayjs;
12
+ updatedAt: Dayjs;
13
+ removedAt: Dayjs | null;
14
+ }
15
+ declare class Int {
16
+ __Scalar__: "int";
17
+ }
18
+ declare class Upload {
19
+ __Scalar__: "upload";
20
+ filename: string;
21
+ mimetype: string;
22
+ encoding: string;
23
+ createReadStream: () => ReadStream | Readable;
24
+ }
25
+ declare class Float {
26
+ __Scalar__: "float";
27
+ }
28
+ declare class ID {
29
+ __Scalar__: "id";
30
+ }
31
+ declare class JSON {
32
+ __Scalar__: "json";
33
+ }
34
+ type SingleFieldType = Int | Float | StringConstructor | BooleanConstructor | ID | DateConstructor | JSON | Type | GraphQLJSON | GraphQLUpload;
35
+ declare const getNonArrayModel: <T = Type>(arraiedModel: T | T[]) => [T, number];
36
+ declare const arraiedModel: <T = any>(modelRef: T, arrDepth?: number) => T | T[];
37
+ declare const applyFnToArrayObjects: (arraiedData: any, fn: (arg: any) => any) => any[];
38
+ declare const gqlScalars: readonly [StringConstructor, BooleanConstructor, DateConstructor, typeof ID, typeof Int, typeof Float, typeof Upload, typeof JSON, MapConstructor];
39
+ type GqlScalar = (typeof gqlScalars)[number];
40
+ declare const gqlScalarNames: readonly ["ID", "Int", "Float", "String", "Boolean", "Date", "Upload", "JSON", "Map"];
41
+ type GqlScalarName = (typeof gqlScalarNames)[number];
42
+ declare const scalarSet: Set<MapConstructor | typeof Int | typeof Upload | typeof Float | typeof ID | typeof JSON | StringConstructor | BooleanConstructor | DateConstructor>;
43
+ declare const scalarNameMap: Map<MapConstructor | typeof Int | typeof Upload | typeof Float | typeof ID | typeof JSON | StringConstructor | BooleanConstructor | DateConstructor, "ID" | "Int" | "Float" | "String" | "Boolean" | "Date" | "Upload" | "JSON" | "Map">;
44
+ declare const scalarArgMap: Map<MapConstructor | typeof Int | typeof Upload | typeof Float | typeof ID | typeof JSON | StringConstructor | BooleanConstructor | DateConstructor, any>;
45
+ declare const scalarDefaultMap: Map<MapConstructor | typeof Int | typeof Upload | typeof Float | typeof ID | typeof JSON | StringConstructor | BooleanConstructor | DateConstructor, any>;
46
+ declare const isGqlClass: (modelRef: Type) => boolean;
47
+ declare const isGqlScalar: (modelRef: Type) => boolean;
48
+ declare const isGqlMap: (modelRef: any) => boolean;
49
+
50
+ export { BaseObject, Float, type GqlScalar, type GqlScalarName, ID, Int, JSON, type SingleFieldType, Upload, applyFnToArrayObjects, arraiedModel, dayjs, getNonArrayModel, gqlScalarNames, gqlScalars, isGqlClass, isGqlMap, isGqlScalar, scalarArgMap, scalarDefaultMap, scalarNameMap, scalarSet };
package/src/scalar.js ADDED
@@ -0,0 +1,281 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var scalar_exports = {};
30
+ __export(scalar_exports, {
31
+ BaseObject: () => BaseObject,
32
+ Dayjs: () => import_dayjs.Dayjs,
33
+ Float: () => Float,
34
+ ID: () => ID,
35
+ Int: () => Int,
36
+ JSON: () => JSON,
37
+ Upload: () => Upload,
38
+ applyFnToArrayObjects: () => applyFnToArrayObjects,
39
+ arraiedModel: () => arraiedModel,
40
+ dayjs: () => dayjs,
41
+ getNonArrayModel: () => getNonArrayModel,
42
+ gqlScalarNames: () => gqlScalarNames,
43
+ gqlScalars: () => gqlScalars,
44
+ isGqlClass: () => isGqlClass,
45
+ isGqlMap: () => isGqlMap,
46
+ isGqlScalar: () => isGqlScalar,
47
+ scalarArgMap: () => scalarArgMap,
48
+ scalarDefaultMap: () => scalarDefaultMap,
49
+ scalarNameMap: () => scalarNameMap,
50
+ scalarSet: () => scalarSet
51
+ });
52
+ module.exports = __toCommonJS(scalar_exports);
53
+ var import_dayjs = __toESM(require("dayjs"));
54
+ const dayjs = import_dayjs.default;
55
+ class BaseObject {
56
+ static {
57
+ __name(this, "BaseObject");
58
+ }
59
+ id;
60
+ createdAt;
61
+ updatedAt;
62
+ removedAt;
63
+ }
64
+ class Int {
65
+ static {
66
+ __name(this, "Int");
67
+ }
68
+ __Scalar__;
69
+ }
70
+ class Upload {
71
+ static {
72
+ __name(this, "Upload");
73
+ }
74
+ __Scalar__;
75
+ filename;
76
+ mimetype;
77
+ encoding;
78
+ createReadStream;
79
+ }
80
+ class Float {
81
+ static {
82
+ __name(this, "Float");
83
+ }
84
+ __Scalar__;
85
+ }
86
+ class ID {
87
+ static {
88
+ __name(this, "ID");
89
+ }
90
+ __Scalar__;
91
+ }
92
+ class JSON {
93
+ static {
94
+ __name(this, "JSON");
95
+ }
96
+ __Scalar__;
97
+ }
98
+ const getNonArrayModel = /* @__PURE__ */ __name((arraiedModel2) => {
99
+ let arrDepth = 0;
100
+ let target = arraiedModel2;
101
+ while (Array.isArray(target)) {
102
+ target = target[0];
103
+ arrDepth++;
104
+ }
105
+ return [
106
+ target,
107
+ arrDepth
108
+ ];
109
+ }, "getNonArrayModel");
110
+ const arraiedModel = /* @__PURE__ */ __name((modelRef, arrDepth = 0) => {
111
+ let target = modelRef;
112
+ for (let i = 0; i < arrDepth; i++) target = [
113
+ target
114
+ ];
115
+ return target;
116
+ }, "arraiedModel");
117
+ const applyFnToArrayObjects = /* @__PURE__ */ __name((arraiedData, fn) => {
118
+ if (Array.isArray(arraiedData)) return arraiedData.map((data) => applyFnToArrayObjects(data, fn));
119
+ return fn(arraiedData);
120
+ }, "applyFnToArrayObjects");
121
+ const gqlScalars = [
122
+ String,
123
+ Boolean,
124
+ Date,
125
+ ID,
126
+ Int,
127
+ Float,
128
+ Upload,
129
+ JSON,
130
+ Map
131
+ ];
132
+ const gqlScalarNames = [
133
+ "ID",
134
+ "Int",
135
+ "Float",
136
+ "String",
137
+ "Boolean",
138
+ "Date",
139
+ "Upload",
140
+ "JSON",
141
+ "Map"
142
+ ];
143
+ const scalarSet = /* @__PURE__ */ new Set([
144
+ String,
145
+ Boolean,
146
+ Date,
147
+ ID,
148
+ Int,
149
+ Float,
150
+ Upload,
151
+ JSON,
152
+ Map
153
+ ]);
154
+ const scalarNameMap = /* @__PURE__ */ new Map([
155
+ [
156
+ ID,
157
+ "ID"
158
+ ],
159
+ [
160
+ Int,
161
+ "Int"
162
+ ],
163
+ [
164
+ Float,
165
+ "Float"
166
+ ],
167
+ [
168
+ String,
169
+ "String"
170
+ ],
171
+ [
172
+ Boolean,
173
+ "Boolean"
174
+ ],
175
+ [
176
+ Date,
177
+ "Date"
178
+ ],
179
+ [
180
+ Upload,
181
+ "Upload"
182
+ ],
183
+ [
184
+ JSON,
185
+ "JSON"
186
+ ],
187
+ [
188
+ Map,
189
+ "Map"
190
+ ]
191
+ ]);
192
+ const scalarArgMap = /* @__PURE__ */ new Map([
193
+ [
194
+ ID,
195
+ null
196
+ ],
197
+ [
198
+ String,
199
+ ""
200
+ ],
201
+ [
202
+ Boolean,
203
+ false
204
+ ],
205
+ [
206
+ Date,
207
+ dayjs(/* @__PURE__ */ new Date(-1))
208
+ ],
209
+ [
210
+ Int,
211
+ 0
212
+ ],
213
+ [
214
+ Float,
215
+ 0
216
+ ],
217
+ [
218
+ JSON,
219
+ {}
220
+ ],
221
+ [
222
+ Map,
223
+ {}
224
+ ]
225
+ ]);
226
+ const scalarDefaultMap = /* @__PURE__ */ new Map([
227
+ [
228
+ ID,
229
+ null
230
+ ],
231
+ [
232
+ String,
233
+ ""
234
+ ],
235
+ [
236
+ Boolean,
237
+ false
238
+ ],
239
+ [
240
+ Date,
241
+ dayjs(/* @__PURE__ */ new Date(-1))
242
+ ],
243
+ [
244
+ Int,
245
+ 0
246
+ ],
247
+ [
248
+ Float,
249
+ 0
250
+ ],
251
+ [
252
+ JSON,
253
+ {}
254
+ ]
255
+ ]);
256
+ const isGqlClass = /* @__PURE__ */ __name((modelRef) => !scalarSet.has(modelRef), "isGqlClass");
257
+ const isGqlScalar = /* @__PURE__ */ __name((modelRef) => scalarSet.has(modelRef), "isGqlScalar");
258
+ const isGqlMap = /* @__PURE__ */ __name((modelRef) => modelRef === Map, "isGqlMap");
259
+ // Annotate the CommonJS export names for ESM import in node:
260
+ 0 && (module.exports = {
261
+ BaseObject,
262
+ Dayjs,
263
+ Float,
264
+ ID,
265
+ Int,
266
+ JSON,
267
+ Upload,
268
+ applyFnToArrayObjects,
269
+ arraiedModel,
270
+ dayjs,
271
+ getNonArrayModel,
272
+ gqlScalarNames,
273
+ gqlScalars,
274
+ isGqlClass,
275
+ isGqlMap,
276
+ isGqlScalar,
277
+ scalarArgMap,
278
+ scalarDefaultMap,
279
+ scalarNameMap,
280
+ scalarSet
281
+ });
package/src/types.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ export { SshOptions } from 'tunnel-ssh';
2
+
3
+ type Type<T = any> = new (...args: any[]) => T;
4
+ type BufferLike = string | Buffer | DataView | number | ArrayBufferView | Uint8Array | ArrayBuffer | SharedArrayBuffer | readonly any[] | readonly number[];
5
+ type GetObject<T> = Omit<{
6
+ [K in keyof T]: T[K];
7
+ }, "prototype">;
8
+ type OptionOf<Obj> = {
9
+ [K in keyof Obj]?: Obj[K] | null;
10
+ };
11
+ type UnType<T> = T extends new (...args: any) => infer U ? U : never;
12
+ interface GraphQLUpload {
13
+ name: string;
14
+ description: string;
15
+ specifiedByUrl: string;
16
+ serialize: any;
17
+ parseValue: any;
18
+ parseLiteral: any;
19
+ extensions: any;
20
+ astNode: any;
21
+ extensionASTNodes: any;
22
+ toConfig(): any;
23
+ toString(): string;
24
+ toJSON(): string;
25
+ inspect(): string;
26
+ }
27
+ interface GraphQLJSON<TInternal = unknown, TExternal = TInternal> {
28
+ name: string;
29
+ description: string;
30
+ specifiedByURL: string;
31
+ serialize: any;
32
+ parseValue: any;
33
+ parseLiteral: any;
34
+ extensions: any;
35
+ astNode: any;
36
+ extensionASTNodes: any;
37
+ get [Symbol.toStringTag](): string;
38
+ toConfig(): any;
39
+ toString(): string;
40
+ toJSON(): string;
41
+ }
42
+
43
+ export type { BufferLike, GetObject, GraphQLJSON, GraphQLUpload, OptionOf, Type, UnType };
package/src/types.js ADDED
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var types_exports = {};
15
+ module.exports = __toCommonJS(types_exports);