@requence/service 1.0.0-alpha.4 → 1.0.0-alpha.45

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +246 -0
  2. package/build/{chunk-0x9092n4.js → chunk-6w7td62p.js} +5 -44
  3. package/build/chunk-6w7td62p.js.map +10 -0
  4. package/build/cli.js +19 -12
  5. package/build/cli.js.map +3 -3
  6. package/build/index.js +930 -863
  7. package/build/index.js.map +18 -16
  8. package/build/types/helpers/src/files/RequenceFile.d.ts +40 -0
  9. package/build/types/helpers/src/files/RequenceFile.d.ts.map +1 -0
  10. package/build/types/helpers/src/files/RequenceStream.d.ts +32 -0
  11. package/build/types/helpers/src/files/RequenceStream.d.ts.map +1 -0
  12. package/build/types/helpers/src/files/fileObject.d.ts +16 -0
  13. package/build/types/helpers/src/files/fileObject.d.ts.map +1 -0
  14. package/build/types/helpers/src/files/index.d.ts +7 -0
  15. package/build/types/helpers/src/files/index.d.ts.map +1 -0
  16. package/build/types/helpers/src/files/isValidMimeType.d.ts +5 -0
  17. package/build/types/helpers/src/files/isValidMimeType.d.ts.map +1 -0
  18. package/build/types/helpers/src/files/mapOutput.d.ts +10 -0
  19. package/build/types/helpers/src/files/mapOutput.d.ts.map +1 -0
  20. package/build/types/helpers/src/files/streamObject.d.ts +14 -0
  21. package/build/types/helpers/src/files/streamObject.d.ts.map +1 -0
  22. package/build/types/helpers/src/files/types.d.ts +4 -0
  23. package/build/types/helpers/src/files/types.d.ts.map +1 -0
  24. package/build/types/helpers/src/index.d.ts +10 -6
  25. package/build/types/helpers/src/index.d.ts.map +1 -1
  26. package/build/types/helpers/src/jsonschema/mapSchema.d.ts +20 -0
  27. package/build/types/helpers/src/jsonschema/mapSchema.d.ts.map +1 -0
  28. package/build/types/helpers/src/jsonschema/types.d.ts +13 -0
  29. package/build/types/helpers/src/jsonschema/types.d.ts.map +1 -0
  30. package/build/types/helpers/src/jsonschema/validate.d.ts +32 -0
  31. package/build/types/helpers/src/jsonschema/validate.d.ts.map +1 -0
  32. package/build/types/helpers/src/jsonschema/zod.d.ts +15 -0
  33. package/build/types/helpers/src/jsonschema/zod.d.ts.map +1 -0
  34. package/build/types/helpers/src/protocol/NodeTree.d.ts +993 -0
  35. package/build/types/helpers/src/protocol/NodeTree.d.ts.map +1 -0
  36. package/build/types/helpers/src/protocol/command.d.ts +853 -0
  37. package/build/types/helpers/src/protocol/command.d.ts.map +1 -0
  38. package/build/types/helpers/src/protocol/helpers.d.ts +7 -0
  39. package/build/types/helpers/src/protocol/helpers.d.ts.map +1 -0
  40. package/build/types/helpers/src/protocol/index.d.ts +7 -0
  41. package/build/types/helpers/src/protocol/index.d.ts.map +1 -0
  42. package/build/types/helpers/src/protocol/nodeType.d.ts +434 -0
  43. package/build/types/helpers/src/protocol/nodeType.d.ts.map +1 -0
  44. package/build/types/helpers/src/protocol/taskOptions.d.ts +23 -0
  45. package/build/types/helpers/src/protocol/taskOptions.d.ts.map +1 -0
  46. package/build/types/helpers/src/protocol/treeNodes.d.ts +1542 -0
  47. package/build/types/helpers/src/protocol/treeNodes.d.ts.map +1 -0
  48. package/build/types/helpers/src/protocol/update.d.ts +379 -0
  49. package/build/types/helpers/src/protocol/update.d.ts.map +1 -0
  50. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts +3 -0
  51. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts.map +1 -0
  52. package/build/types/helpers/src/utils/clone.d.ts +3 -0
  53. package/build/types/helpers/src/utils/clone.d.ts.map +1 -0
  54. package/build/types/helpers/src/utils/createObjectProxy.d.ts +2 -0
  55. package/build/types/helpers/src/utils/createObjectProxy.d.ts.map +1 -0
  56. package/build/types/helpers/src/{createRemotePromise.d.ts → utils/createRemotePromise.d.ts} +1 -1
  57. package/build/types/helpers/src/utils/createRemotePromise.d.ts.map +1 -0
  58. package/build/types/helpers/src/utils/isRecord.d.ts +2 -0
  59. package/build/types/helpers/src/utils/isRecord.d.ts.map +1 -0
  60. package/build/types/helpers/src/utils/mapData.d.ts +18 -0
  61. package/build/types/helpers/src/utils/mapData.d.ts.map +1 -0
  62. package/build/types/helpers/src/{utils.d.ts → utils/matchSchema.d.ts} +2 -2
  63. package/build/types/helpers/src/utils/matchSchema.d.ts.map +1 -0
  64. package/build/types/helpers/src/utils/obfuscate.d.ts.map +1 -0
  65. package/build/types/helpers/src/utils/requenceCallback.d.ts +17 -0
  66. package/build/types/helpers/src/utils/requenceCallback.d.ts.map +1 -0
  67. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts +8 -0
  68. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts.map +1 -0
  69. package/build/types/service/src/createAmqpConnection.d.ts +19 -20
  70. package/build/types/service/src/createAmqpConnection.d.ts.map +1 -1
  71. package/build/types/service/src/helpers.d.ts +72 -99
  72. package/build/types/service/src/helpers.d.ts.map +1 -1
  73. package/build/types/service/src/index.d.ts +8 -4
  74. package/build/types/service/src/index.d.ts.map +1 -1
  75. package/build/types/service/src/macro.d.ts +2 -0
  76. package/build/types/service/src/macro.d.ts.map +1 -0
  77. package/build/types/service/src/mapInput.d.ts +2 -0
  78. package/build/types/service/src/mapInput.d.ts.map +1 -0
  79. package/build/types/service/src/utils.d.ts +6 -0
  80. package/build/types/service/src/utils.d.ts.map +1 -0
  81. package/package.json +8 -7
  82. package/build/chunk-0x9092n4.js.map +0 -12
  83. package/build/types/helpers/src/clone.d.ts +0 -3
  84. package/build/types/helpers/src/clone.d.ts.map +0 -1
  85. package/build/types/helpers/src/createObjectProxy.d.ts +0 -2
  86. package/build/types/helpers/src/createObjectProxy.d.ts.map +0 -1
  87. package/build/types/helpers/src/createRemotePromise.d.ts.map +0 -1
  88. package/build/types/helpers/src/obfuscate.d.ts.map +0 -1
  89. package/build/types/helpers/src/utils.d.ts.map +0 -1
  90. /package/build/types/helpers/src/{obfuscate.d.ts → utils/obfuscate.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
- import { type Context } from '@requence/helpers/context';
2
- import type { Nodes, ServiceNode } from '@requence/helpers/protocol';
1
+ import { AsyncLocalStorage } from 'node:async_hooks';
2
+ import type { TaskOptions } from '../../helpers/src/protocol/index.js';
3
3
  export type JSONValue = string | number | boolean | {
4
4
  [x: string]: JSONValue;
5
5
  } | Array<JSONValue> | null;
@@ -7,6 +7,8 @@ export declare class RetryError extends Error {
7
7
  delay?: number | undefined;
8
8
  constructor(delay?: number | undefined);
9
9
  }
10
+ export declare class SkipError extends Error {
11
+ }
10
12
  export declare class AbortError extends Error {
11
13
  }
12
14
  declare const OUTPUT_VALUE: unique symbol;
@@ -14,108 +16,79 @@ type OutputValue = {
14
16
  [OUTPUT_VALUE]: string | null;
15
17
  value: any;
16
18
  };
17
- export declare function unwrapResult(result: unknown): {
18
- value: any;
19
+ export declare function processData(params: {
20
+ data: unknown;
21
+ outputName: null | string;
22
+ options: Pick<TaskOptions, 'uploadUrl' | 'streamUrl'>;
23
+ onCallback: (callback: (...args: any[]) => void) => {
24
+ callbackId: string;
25
+ sourceId: string;
26
+ };
27
+ onDone: () => void;
28
+ }): Promise<unknown>;
29
+ export declare function unwrapResult(params: {
30
+ result: unknown;
31
+ options: Pick<TaskOptions, 'uploadUrl' | 'streamUrl'>;
32
+ onCallback: (callback: (...args: any[]) => void) => {
33
+ callbackId: string;
34
+ sourceId: string;
35
+ };
36
+ onDone: () => void;
37
+ }): Promise<{
38
+ value: unknown;
19
39
  outputName: string | null;
20
- };
21
- export default function createExtendedContextHelper(options: {
22
- serviceId: string;
40
+ }>;
41
+ export default function createContextHelper(options: {
23
42
  taskId: string;
24
- context: Context;
25
- nodes: Nodes;
26
- state: Record<string, any>;
43
+ input: unknown;
44
+ configuration: unknown;
27
45
  onLog: (method: 'log' | 'warn' | 'info' | 'error', data: any[]) => void;
28
46
  onDefer: (reason?: string) => string;
29
- onStateChange: (newObj: Record<string, unknown>) => void;
30
- }): {
31
- internal: {
32
- results: Map<string, {
33
- node: {
34
- type: "entry";
35
- id: "__entry__";
36
- output: import("@requence/helpers/protocol").Output[];
37
- inputSchema?: import("json-schema").JSONSchema7 | null | undefined;
38
- metaSchema?: import("json-schema").JSONSchema7 | null | undefined;
39
- meta?: Record<string, any> | undefined;
40
- } | {
41
- type: "service";
42
- id: string;
43
- name: string;
44
- output: import("@requence/helpers/protocol").Output[];
45
- version: string;
46
- inputSchema?: {
47
- type: "object";
48
- properties: Record<string, import("json-schema").JSONSchema7>;
49
- required?: string[] | undefined;
50
- description?: string | undefined;
51
- maxProperties?: number | undefined;
52
- minProperties?: number | undefined;
53
- additionalProperties?: boolean | undefined;
54
- } | null | undefined;
55
- meta?: Record<string, any> | undefined;
56
- configuration?: any;
57
- configurationSchema?: import("json-schema").JSONSchema7 | null | undefined;
58
- alias?: string | undefined;
59
- ttl?: number | undefined;
60
- retry?: number | undefined;
61
- retryDelay?: number | undefined;
62
- } | {
63
- type: "catch";
64
- id: string;
65
- output: import("@requence/helpers/protocol").Output[];
66
- subject: string;
67
- meta?: Record<string, any> | undefined;
68
- } | {
69
- type: "logic";
70
- id: string;
71
- output: import("@requence/helpers/protocol").Output[];
72
- script: string;
73
- concurrency: boolean;
74
- language: "javascript" | "python" | "typescript";
75
- maxExecutionTime: number;
76
- inputSchema?: {
77
- type: "object";
78
- properties: Record<string, import("json-schema").JSONSchema7>;
79
- required?: string[] | undefined;
80
- description?: string | undefined;
81
- maxProperties?: number | undefined;
82
- minProperties?: number | undefined;
83
- additionalProperties?: boolean | undefined;
84
- } | null | undefined;
85
- meta?: Record<string, any> | undefined;
86
- alias?: string | undefined;
87
- } | {
88
- type: "or";
89
- id: string;
90
- output: import("@requence/helpers/protocol").Output[];
91
- meta?: Record<string, any> | undefined;
92
- alias?: string | undefined;
93
- };
94
- executionDate: Date | null;
95
- data: any;
96
- error: string;
97
- }>;
47
+ onCallback: (params: {
48
+ sourceId: string;
49
+ callbackId: string;
50
+ outputName: string | null;
51
+ propertyPath: (string | number)[];
52
+ arg: unknown;
53
+ }) => void;
54
+ }): readonly [{
55
+ readonly taskId: string;
56
+ readonly input: any;
57
+ readonly configuration: any;
58
+ readonly toOutput: (name: string | null, value: unknown) => OutputValue;
59
+ readonly defer: (reason?: string) => string;
60
+ readonly debug: {
61
+ readonly log: (...data: any[]) => void;
62
+ readonly info: (...data: any[]) => void;
63
+ readonly warn: (...data: any[]) => void;
64
+ readonly error: (...data: any[]) => void;
98
65
  };
99
- getInput(): unknown;
100
- getMeta(): unknown;
101
- getData(alias?: string): any;
102
- getError(alias: string): string | null;
103
- } & {
104
- taskId: string;
105
- toOutput(name: string | null, value: unknown): OutputValue;
106
- defer: (reason?: string) => string;
107
- getConfiguration(): unknown;
108
- getNode(): ServiceNode;
109
- state: Record<string, any>;
110
- debug: {
111
- log(...data: any[]): void;
112
- info(...data: any[]): void;
113
- warn(...data: any[]): void;
114
- error(...data: any[]): void;
66
+ readonly retry: (delay?: number) => never;
67
+ readonly abort: (reason?: string) => never;
68
+ readonly skip: () => never;
69
+ readonly terminated: Promise<string>;
70
+ }, Promise<string> & {
71
+ resolve: (value: string | PromiseLike<string>) => void;
72
+ reject: (reason?: any) => void;
73
+ promise: Promise<string>;
74
+ }];
75
+ export type ContextHelper = ReturnType<typeof createContextHelper>[0];
76
+ export declare const handlerStorage: AsyncLocalStorage<{
77
+ readonly taskId: string;
78
+ readonly input: any;
79
+ readonly configuration: any;
80
+ readonly toOutput: (name: string | null, value: unknown) => OutputValue;
81
+ readonly defer: (reason?: string) => string;
82
+ readonly debug: {
83
+ readonly log: (...data: any[]) => void;
84
+ readonly info: (...data: any[]) => void;
85
+ readonly warn: (...data: any[]) => void;
86
+ readonly error: (...data: any[]) => void;
115
87
  };
116
- retry(delay?: number): never;
117
- abort(reason?: string): never;
118
- };
119
- export type ExtendendContextHelper = ReturnType<typeof createExtendedContextHelper>;
88
+ readonly retry: (delay?: number) => never;
89
+ readonly abort: (reason?: string) => never;
90
+ readonly skip: () => never;
91
+ readonly terminated: Promise<string>;
92
+ }>;
120
93
  export {};
121
94
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EAGb,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAEpE,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC1B,KAAK,CAAC,SAAS,CAAC,GAChB,IAAI,CAAA;AAER,qBAAa,UAAW,SAAQ,KAAK;IAChB,KAAK,CAAC,EAAE,MAAM;gBAAd,KAAK,CAAC,EAAE,MAAM,YAAA;CAGlC;AAED,qBAAa,UAAW,SAAQ,KAAK;CAAG;AAExC,QAAA,MAAM,YAAY,eAAyB,CAAA;AAE3C,KAAK,WAAW,GAAG;IACjB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,KAAK,EAAE,GAAG,CAAA;CACX,CAAA;AAMD,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO;;;EAK3C;AAED,MAAM,CAAC,OAAO,UAAU,2BAA2B,CAAC,OAAO,EAAE;IAC3D,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1B,KAAK,EAAE,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IACvE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IACpC,aAAa,EAAE,CAAC,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,CAAA;QACjC,GAAG,EAAE,OAAO,CAAA;KACb,KAAK,IAAI,CAAA;CACX;;;;8BAWoB,MAAM,GAAG,IAAI,SAAS,OAAO,KAAG,WAAW;8BAnB3C,MAAM,KAAK,MAAM;;gCA4BjB,GAAG,EAAE;iCAGJ,GAAG,EAAE;iCAGL,GAAG,EAAE;kCAGJ,GAAG,EAAE;;6BAIR,MAAM;8BAGL,MAAM;;;;;;;GAU1B;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAA;AAErE,eAAO,MAAM,cAAc;;;;8BAvCN,MAAM,GAAG,IAAI,SAAS,OAAO,KAAG,WAAW;8BAnB3C,MAAM,KAAK,MAAM;;gCA4BjB,GAAG,EAAE;iCAGJ,GAAG,EAAE;iCAGL,GAAG,EAAE;kCAGJ,GAAG,EAAE;;6BAIR,MAAM;8BAGL,MAAM;;;EAcyC,CAAA"}
@@ -1,13 +1,17 @@
1
+ import type { AmqpConnectionManagerOptions } from 'amqp-connection-manager';
1
2
  import { type ConnectionApi, type MessageHandler } from './createAmqpConnection.ts';
2
- export type ServiceApi<V extends keyof Requence.Version | (string & {})> = ConnectionApi<V>;
3
+ export { RequenceFile, RequenceStream } from '../../helpers/src/files/index.js';
4
+ export { createCallback, type RequenceCallback, type WrappedRequenceCallback, } from '../../helpers/src/index.js';
5
+ export * from './utils.ts';
6
+ export type ServiceApi<V extends keyof RequenceService.Version | (string & {})> = ConnectionApi<V>;
3
7
  interface ServiceOptions<V extends string> {
4
8
  accessToken?: string;
5
9
  version: V;
6
10
  prefetch?: number;
7
11
  connectionTimeout?: number;
8
12
  silent?: boolean;
13
+ connectionOptions?: AmqpConnectionManagerOptions['connectionOptions'];
9
14
  }
10
- export declare function createService<V extends keyof Requence.Version | (string & {})>(version: V, messageHandler: MessageHandler<V>): ServiceApi<V>;
11
- export declare function createService<V extends keyof Requence.Version | (string & {})>(options: ServiceOptions<V>, messageHandler: MessageHandler<V>): ServiceApi<V>;
12
- export {};
15
+ export declare function createService<V extends keyof RequenceService.Version | (string & {})>(version: V, messageHandler: MessageHandler<V>): ServiceApi<V>;
16
+ export declare function createService<V extends keyof RequenceService.Version | (string & {})>(options: ServiceOptions<V>, messageHandler: MessageHandler<V>): ServiceApi<V>;
13
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAKA,OAA6B,EAC3B,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAA;AAElC,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,QAAQ,CAAC,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,IACrE,aAAa,CAAC,CAAC,CAAC,CAAA;AAElB,UAAU,cAAc,CAAC,CAAC,SAAS,MAAM;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,CAAC,CAAA;IACV,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAkBD,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,QAAQ,CAAC,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAC5E,OAAO,EAAE,CAAC,EACV,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,GAChC,UAAU,CAAC,CAAC,CAAC,CAAA;AAChB,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,QAAQ,CAAC,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAC5E,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAC1B,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,GAChC,UAAU,CAAC,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"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ceMappingURL=macro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macro.d.ts","sourceRoot":"","sources":["../../../../src/macro.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,WAEzB"}
@@ -0,0 +1,2 @@
1
+ export default function mapInput(data: unknown): unknown;
2
+ //# sourceMappingURL=mapInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapInput.d.ts","sourceRoot":"","sources":["../../../../src/mapInput.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAWvD"}
@@ -0,0 +1,6 @@
1
+ export declare function wrapIterable<T extends Iterable<any> | AsyncIterable<any>>(iterable: T): T;
2
+ export declare function asyncEventEmitter<T>(initial?: Array<T>): {
3
+ push: (value: T) => void;
4
+ [Symbol.asyncIterator](): AsyncIterator<T>;
5
+ };
6
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils.ts"],"names":[],"mappings":"AAQA,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,EACvE,QAAQ,EAAE,CAAC,GACV,CAAC,CAmDH;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,OAAO,GAAE,KAAK,CAAC,CAAC,CAAM;kBAWzC,CAAC;8BAOW,aAAa,CAAC,CAAC,CAAC;EAyB7C"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@requence/service",
3
3
  "type": "module",
4
- "version": "1.0.0-alpha.4",
4
+ "version": "1.0.0-alpha.45",
5
5
  "bin": {
6
6
  "requence-service": "build/cli.js"
7
7
  },
@@ -11,18 +11,19 @@
11
11
  "build": "ADD_ENTRYPOINT=src/cli.ts bun -e \"import('@requence/utils/build-package.mts')\" && bun build-declaration"
12
12
  },
13
13
  "dependencies": {
14
+ "ajv": "^8.17.1",
14
15
  "amqp-connection-manager": "^4.1.14",
15
- "amqplib": "^0.10.5",
16
- "chalk": "^5.3.0",
17
- "prettier": "^3.4.2",
18
- "semver": "^7.6.3",
16
+ "amqplib": "^0.10.8",
17
+ "chalk": "^5.6.2",
18
+ "mime-types": "^3.0.1",
19
19
  "yargs": "^17.7.2",
20
- "zod": "^3.23.8"
20
+ "zod": "^3.25.76"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@requence/helpers": "workspace:*",
24
24
  "@requence/utils": "workspace:*",
25
- "@types/semver": "^7.5.8"
25
+ "@types/amqplib": "^0.10.7",
26
+ "@types/bun": "^1.2.23"
26
27
  },
27
28
  "exports": {
28
29
  "default": "./build/index.js",
@@ -1,12 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../helpers/src/obfuscate.ts", "../../helpers/src/clone.ts", "../../helpers/src/createObjectProxy.ts"],
4
- "sourcesContent": [
5
- "const separator = '\\u{f6ee}'\n\nconst base65Chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$'\n\nconst base65CharToIndex: Record<string, number> = {}\nfor (let i = 0; i < base65Chars.length; i++) {\n base65CharToIndex[base65Chars[i]] = i\n}\n\nexport function obfuscate(...parts: Array<string>) {\n const str = parts.join(separator)\n let binaryString = ''\n\n for (let i = 0; i < str.length; i++) {\n const charCode = str.charCodeAt(i)\n binaryString += charCode.toString(2).padStart(16, '0')\n }\n\n let encodedString = ''\n const chunkSize = 6\n let paddingCount = 0\n\n for (let i = 0; i < binaryString.length; i += chunkSize) {\n let chunk = binaryString.substring(i, i + chunkSize)\n\n if (chunk.length < chunkSize) {\n paddingCount = chunkSize - chunk.length\n chunk = chunk.padEnd(chunkSize, '0')\n }\n\n const decimalValue = parseInt(chunk, 2)\n encodedString += base65Chars[decimalValue]\n }\n\n return encodedString + paddingCount.toString()\n}\n\nexport function randomString(length: number) {\n const randomValues = new Uint8Array(length)\n crypto.getRandomValues(randomValues)\n\n let randomString = ''\n for (let i = 0; i < length; i++) {\n randomString += base65Chars[randomValues[i] % base65Chars.length]\n }\n\n return randomString\n}\n\nexport function deobfuscate(str: string) {\n const paddingCount = parseInt(str.slice(-1), 10)\n str = str.slice(0, -1)\n\n let binaryString = ''\n\n for (let i = 0; i < str.length; i++) {\n const decimalValue = base65CharToIndex[str[i]]\n const binaryChunk = decimalValue.toString(2).padStart(6, '0')\n binaryString += binaryChunk\n }\n\n if (paddingCount > 0) {\n binaryString = binaryString.slice(0, -paddingCount)\n }\n\n let decodedString = ''\n const charSize = 16\n\n for (let i = 0; i < binaryString.length; i += charSize) {\n const byte = binaryString.substring(i, i + charSize)\n if (byte.length === 16) {\n const charCode = parseInt(byte, 2)\n decodedString += String.fromCharCode(charCode)\n }\n }\n\n return decodedString.split(separator)\n}\n",
6
- "export const CLONE_SYMBOL = Symbol('original')\n\nexport default function clone(data: any): any {\n if (typeof data !== 'object' || data === null) {\n return data\n }\n\n const target = (data as any)[CLONE_SYMBOL]\n if (target) {\n return clone(target)\n }\n\n if (Array.isArray(data)) {\n return data.map(clone)\n }\n\n return Object.fromEntries(\n Object.entries(data).map(([key, value]) => [key, clone(value)]),\n )\n}\n",
7
- "import { CLONE_SYMBOL } from './clone.ts'\n\nexport default function createObjectProxy(\n obj: Record<string, unknown>,\n onChange: (newObj: Record<string, unknown>) => void,\n) {\n return new Proxy(obj, {\n set(target, property, newValue) {\n const result = Reflect.set(target, property, newValue)\n onChange(target)\n return result\n },\n deleteProperty(target, property) {\n const result = Reflect.deleteProperty(target, property)\n onChange(target)\n return result\n },\n get(target, property, receiver) {\n if (property === CLONE_SYMBOL) {\n return target\n }\n\n const result = Reflect.get(target, property, receiver)\n\n if (typeof result === 'object' && result !== null) {\n return createObjectProxy(result, () => onChange(target))\n }\n\n return result\n },\n })\n}\n"
8
- ],
9
- "mappings": ";AAAA,IAAM,YAAY;AAElB,IAAM,cACJ;AAEF,IAAM,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[]
12
- }
@@ -1,3 +0,0 @@
1
- export declare const CLONE_SYMBOL: unique symbol;
2
- export default function clone(data: any): any;
3
- //# sourceMappingURL=clone.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../../../../helpers/src/clone.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,eAAqB,CAAA;AAE9C,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAiB5C"}
@@ -1,2 +0,0 @@
1
- export default function createObjectProxy(obj: Record<string, unknown>, onChange: (newObj: Record<string, unknown>) => void): Record<string, unknown>;
2
- //# sourceMappingURL=createObjectProxy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createObjectProxy.d.ts","sourceRoot":"","sources":["../../../../../helpers/src/createObjectProxy.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,2BA2BpD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"createRemotePromise.d.ts","sourceRoot":"","sources":["../../../../../helpers/src/createRemotePromise.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,CAAC,GAAG,IAAI,EAClD,OAAO,CAAC,EAAE,CACR,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,EAC3B,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,KACzB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;qBAEI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI;sBAC1B,GAAG,KAAK,IAAI;;EAgC3C;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"obfuscate.d.ts","sourceRoot":"","sources":["../../../../../helpers/src/obfuscate.ts"],"names":[],"mappings":"AAUA,wBAAgB,SAAS,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,UA0BhD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,UAU1C;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,YA4BtC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../helpers/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,wBAAgB,WAAW,CAAC,MAAM,SAAS,CAAC,CAAC,SAAS,EACpD,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;AAC3B,wBAAgB,WAAW,CAAC,MAAM,SAAS,CAAC,CAAC,SAAS,EACpD,MAAM,EAAE,MAAM,GACb,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA"}