@requence/service 1.0.0-alpha.5 → 1.0.0-alpha.51

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 (99) hide show
  1. package/CHANGELOG.md +276 -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 +123 -25
  5. package/build/cli.js.map +3 -3
  6. package/build/index.js +979 -840
  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 +12 -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 +17 -0
  33. package/build/types/helpers/src/jsonschema/zod.d.ts.map +1 -0
  34. package/build/types/helpers/src/protocol/NodeTree.d.ts +496 -0
  35. package/build/types/helpers/src/protocol/NodeTree.d.ts.map +1 -0
  36. package/build/types/helpers/src/protocol/command.d.ts +481 -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 +8 -0
  41. package/build/types/helpers/src/protocol/index.d.ts.map +1 -0
  42. package/build/types/helpers/src/protocol/nodeType.d.ts +171 -0
  43. package/build/types/helpers/src/protocol/nodeType.d.ts.map +1 -0
  44. package/build/types/helpers/src/protocol/taskOptions.d.ts +20 -0
  45. package/build/types/helpers/src/protocol/taskOptions.d.ts.map +1 -0
  46. package/build/types/helpers/src/protocol/templateNodeTypes.d.ts +267 -0
  47. package/build/types/helpers/src/protocol/templateNodeTypes.d.ts.map +1 -0
  48. package/build/types/helpers/src/protocol/treeNodes.d.ts +836 -0
  49. package/build/types/helpers/src/protocol/treeNodes.d.ts.map +1 -0
  50. package/build/types/helpers/src/protocol/update.d.ts +383 -0
  51. package/build/types/helpers/src/protocol/update.d.ts.map +1 -0
  52. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts +3 -0
  53. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts.map +1 -0
  54. package/build/types/helpers/src/utils/clone.d.ts +3 -0
  55. package/build/types/helpers/src/utils/clone.d.ts.map +1 -0
  56. package/build/types/helpers/src/utils/createObjectProxy.d.ts +2 -0
  57. package/build/types/helpers/src/utils/createObjectProxy.d.ts.map +1 -0
  58. package/build/types/helpers/src/utils/debounce.d.ts +4 -0
  59. package/build/types/helpers/src/utils/debounce.d.ts.map +1 -0
  60. package/build/types/helpers/src/utils/guards.d.ts +3 -0
  61. package/build/types/helpers/src/utils/guards.d.ts.map +1 -0
  62. package/build/types/helpers/src/utils/mapData.d.ts +18 -0
  63. package/build/types/helpers/src/utils/mapData.d.ts.map +1 -0
  64. package/build/types/helpers/src/{utils.d.ts → utils/matchSchema.d.ts} +2 -2
  65. package/build/types/helpers/src/utils/matchSchema.d.ts.map +1 -0
  66. package/build/types/helpers/src/utils/obfuscate.d.ts.map +1 -0
  67. package/build/types/helpers/src/utils/obj.d.ts +4 -0
  68. package/build/types/helpers/src/utils/obj.d.ts.map +1 -0
  69. package/build/types/helpers/src/utils/requenceCallback.d.ts +17 -0
  70. package/build/types/helpers/src/utils/requenceCallback.d.ts.map +1 -0
  71. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts +8 -0
  72. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts.map +1 -0
  73. package/build/types/helpers/src/utils/types.d.ts +7 -0
  74. package/build/types/helpers/src/utils/types.d.ts.map +1 -0
  75. package/build/types/service/src/createAmqpConnection.d.ts +29 -27
  76. package/build/types/service/src/createAmqpConnection.d.ts.map +1 -1
  77. package/build/types/service/src/errors.d.ts +3 -0
  78. package/build/types/service/src/errors.d.ts.map +1 -0
  79. package/build/types/service/src/helpers.d.ts +72 -90
  80. package/build/types/service/src/helpers.d.ts.map +1 -1
  81. package/build/types/service/src/index.d.ts +11 -4
  82. package/build/types/service/src/index.d.ts.map +1 -1
  83. package/build/types/service/src/macro.d.ts +2 -0
  84. package/build/types/service/src/macro.d.ts.map +1 -0
  85. package/build/types/service/src/mapInput.d.ts +2 -0
  86. package/build/types/service/src/mapInput.d.ts.map +1 -0
  87. package/build/types/service/src/utils.d.ts +6 -0
  88. package/build/types/service/src/utils.d.ts.map +1 -0
  89. package/package.json +10 -7
  90. package/build/chunk-0x9092n4.js.map +0 -12
  91. package/build/types/helpers/src/clone.d.ts +0 -3
  92. package/build/types/helpers/src/clone.d.ts.map +0 -1
  93. package/build/types/helpers/src/createObjectProxy.d.ts +0 -2
  94. package/build/types/helpers/src/createObjectProxy.d.ts.map +0 -1
  95. package/build/types/helpers/src/createRemotePromise.d.ts +0 -7
  96. package/build/types/helpers/src/createRemotePromise.d.ts.map +0 -1
  97. package/build/types/helpers/src/obfuscate.d.ts.map +0 -1
  98. package/build/types/helpers/src/utils.d.ts.map +0 -1
  99. /package/build/types/helpers/src/{obfuscate.d.ts → utils/obfuscate.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,uBAAwB,SAAQ,KAAK;CAAG"}
@@ -1,12 +1,14 @@
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
- } | Array<JSONValue> | null;
5
+ } | Array<JSONValue> | null | undefined;
6
6
  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,99 +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
- type NodeResult = {
22
- executionDate: null | Date;
23
- data: any | null;
24
- error: string | null;
25
- };
40
+ }>;
26
41
  export default function createContextHelper(options: {
27
- serviceId: string;
28
42
  taskId: string;
29
- context: Context;
30
- nodes: Nodes;
31
- state: Record<string, any>;
43
+ input: unknown;
44
+ configuration: unknown;
32
45
  onLog: (method: 'log' | 'warn' | 'info' | 'error', data: any[]) => void;
33
46
  onDefer: (reason?: string) => string;
34
- onStateChange: (newObj: Record<string, unknown>) => void;
35
- }): {
36
- taskId: string;
37
- getInput(): unknown;
38
- getMeta(): unknown;
39
- getData(): {
40
- [x: string]: any;
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;
41
65
  };
42
- toOutput(name: string | null, value: unknown): OutputValue;
43
- defer: (reason?: string) => string;
44
- getConfiguration(): unknown;
45
- getNode(): ServiceNode & NodeResult;
46
- getNodes(): (({
47
- type: "entry";
48
- id: "__entry__";
49
- output: import("@requence/helpers/protocol").Output[];
50
- inputSchema: import("json-schema").JSONSchema7;
51
- metaSchema: import("json-schema").JSONSchema7;
52
- meta?: Record<string, any> | undefined;
53
- } | {
54
- type: "service";
55
- id: string;
56
- name: string;
57
- output: import("@requence/helpers/protocol").Output[];
58
- inputSchema: {
59
- type: "object";
60
- properties: Record<string, import("json-schema").JSONSchema7>;
61
- additionalProperties: boolean;
62
- required?: string[] | undefined;
63
- description?: string | undefined;
64
- maxProperties?: number | undefined;
65
- minProperties?: number | undefined;
66
- } | {
67
- type: "null";
68
- };
69
- version: string;
70
- configurationSchema: import("json-schema").JSONSchema7;
71
- meta?: Record<string, any> | undefined;
72
- configuration?: any;
73
- alias?: string | undefined;
74
- ttl?: number | undefined;
75
- retry?: number | undefined;
76
- retryDelay?: number | undefined;
77
- } | {
78
- type: "catch";
79
- id: string;
80
- output: import("@requence/helpers/protocol").Output[];
81
- subject: string;
82
- meta?: Record<string, any> | undefined;
83
- } | {
84
- type: "logic";
85
- id: string;
86
- output: import("@requence/helpers/protocol").Output[];
87
- script: string;
88
- concurrency: boolean;
89
- language: "javascript" | "python" | "typescript";
90
- maxExecutionTime: number;
91
- meta?: Record<string, any> | undefined;
92
- alias?: string | undefined;
93
- } | {
94
- type: "or";
95
- id: string;
96
- output: import("@requence/helpers/protocol").Output[];
97
- meta?: Record<string, any> | undefined;
98
- alias?: string | undefined;
99
- }) & NodeResult)[];
100
- state: Record<string, any>;
101
- debug: {
102
- log(...data: any[]): void;
103
- info(...data: any[]): void;
104
- warn(...data: any[]): void;
105
- 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
+ }, {
71
+ promise: Promise<string>;
72
+ resolve: (value?: string | PromiseLike<string> | undefined) => void;
73
+ reject: (reason?: any) => void;
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;
106
87
  };
107
- retry(delay?: number): never;
108
- abort(reason?: string): never;
109
- };
110
- export type ContextHelper = ReturnType<typeof createContextHelper>;
88
+ readonly retry: (delay?: number) => never;
89
+ readonly abort: (reason?: string) => never;
90
+ readonly skip: () => never;
91
+ readonly terminated: Promise<string>;
92
+ }>;
111
93
  export {};
112
94
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,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;AAUD,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO;;;EAK3C;AAED,KAAK,UAAU,GAAG;IAChB,aAAa,EAAE,IAAI,GAAG,IAAI,CAAA;IAC1B,IAAI,EAAE,GAAG,GAAG,IAAI,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,OAAO,EAAE;IACnD,SAA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AA;IACd,aAAa,EAAE,OAAO,CAAA;IACtB,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,UAAU,EAAE,CAAC,MAAM,EAAE;QACnB,QAAQ,EAAE,MAAM,CAAA;QAChB,UAAU,EAAE,MAAM,CAAA;QAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;QACzB,YAAY,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,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;;;;;;mBAeg6wC,CAAC;GAL37wC;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,20 @@
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 './errors.ts';
6
+ export * from './utils.ts';
7
+ export { MessageHandler } from './createAmqpConnection.ts';
8
+ export type ServiceApi<V extends keyof RequenceService.Version | (string & {})> = ConnectionApi<V>;
3
9
  interface ServiceOptions<V extends string> {
4
10
  accessToken?: string;
11
+ devToken?: string;
5
12
  version: V;
6
13
  prefetch?: number;
7
14
  connectionTimeout?: number;
8
15
  silent?: boolean;
16
+ connectionOptions?: AmqpConnectionManagerOptions['connectionOptions'];
9
17
  }
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 {};
18
+ export declare function createService<V extends keyof RequenceService.Version | (string & {})>(version: V, messageHandler: MessageHandler<V>): ServiceApi<V>;
19
+ export declare function createService<V extends keyof RequenceService.Version | (string & {})>(options: ServiceOptions<V>, messageHandler: MessageHandler<V>): ServiceApi<V>;
13
20
  //# 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,OA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B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iBAAiB,CAAC,EAAE,4BAA4B,CAAC,mBAAmB,CAAC,CAAA;CACtE;AAUD,wBAAgB,aAAa,CAC3B,CAAC,SAAS,MAAM,eAAe,CAAC,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EACvD,OAAO,EAAE,CAAC,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;AAC/D,wBAAgB,aAAa,CAC3B,CAAC,SAAS,MAAM,eAAe,CAAC,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EACvD,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare function libVersion(): string;
2
+ //# sourceMappingURL=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,28 +1,31 @@
1
1
  {
2
2
  "name": "@requence/service",
3
3
  "type": "module",
4
- "version": "1.0.0-alpha.5",
4
+ "version": "1.0.0-alpha.51",
5
5
  "bin": {
6
6
  "requence-service": "build/cli.js"
7
7
  },
8
8
  "scripts": {
9
9
  "check-types": "tsc",
10
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10
11
  "build-declaration": "tsc -p tsconfig.declaration.json && tsc-alias -p tsconfig.declaration.json 2>/dev/null",
11
12
  "build": "ADD_ENTRYPOINT=src/cli.ts bun -e \"import('@requence/utils/build-package.mts')\" && bun build-declaration"
12
13
  },
13
14
  "dependencies": {
15
+ "ajv": "^8.17.1",
14
16
  "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",
17
+ "amqplib": "^0.10.8",
18
+ "chalk": "^5.6.2",
19
+ "eventsource-client": "^1.2.0",
20
+ "mime-types": "^3.0.1",
19
21
  "yargs": "^17.7.2",
20
- "zod": "^3.24.1"
22
+ "zod": "^4.3.6"
21
23
  },
22
24
  "devDependencies": {
23
25
  "@requence/helpers": "workspace:*",
24
26
  "@requence/utils": "workspace:*",
25
- "@types/semver": "^7.5.8"
27
+ "@types/amqplib": "^0.10.7",
28
+ "@types/bun": "^1.2.23"
26
29
  },
27
30
  "exports": {
28
31
  "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,oBAA4C,CAAC;AACnD,SAAS,IAAI,EAAG,IAAI,YAAY,QAAQ,KAAK;AAC3C,oBAAkB,YAAY,MAAM;AACtC;AAEO,SAAS,SAAS,IAAI,OAAsB;AACjD,QAAM,MAAM,MAAM,KAAK,SAAS;AAChC,MAAI,eAAe;AAEnB,WAAS,IAAI,EAAG,IAAI,IAAI,QAAQ,KAAK;AACnC,UAAM,WAAW,IAAI,WAAW,CAAC;AACjC,oBAAgB,SAAS,SAAS,CAAC,EAAE,SAAS,IAAI,GAAG;AAAA,EACvD;AAEA,MAAI,gBAAgB;AACpB,QAAM,YAAY;AAClB,MAAI,eAAe;AAEnB,WAAS,IAAI,EAAG,IAAI,aAAa,QAAQ,KAAK,WAAW;AACv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EACvB;AAEA,SAAO,OAAO,YACZ,OAAO,QAAQ,IAAI,EAAE,IAAI,EAAE,KAAK,WAAW,CAAC,KAAK,MAAM,KAAK,CAAC,CAAC,CAChE;AAAA;;AChBF,SAAwB,iBAAiB,CACvC,KACA,UACA;AACA,SAAO,IAAI,MAAM,KAAK;AAAA,IACpB,GAAG,CAAC,QAAQ,UAAU,UAAU;AAC9B,YAAM,SAAS,QAAQ,IAAI,QAAQ,UAAU,QAAQ;AACrD,eAAS,MAAM;AACf,aAAO;AAAA;AAAA,IAET,cAAc,CAAC,QAAQ,UAAU;AAC/B,YAAM,SAAS,QAAQ,eAAe,QAAQ,QAAQ;AACtD,eAAS,MAAM;AACf,aAAO;AAAA;AAAA,IAET,GAAG,CAAC,QAAQ,UAAU,UAAU;AAC9B,UAAI,aAAa,cAAc;AAC7B,eAAO;AAAA,MACT;AAEA,YAAM,SAAS,QAAQ,IAAI,QAAQ,UAAU,QAAQ;AAErD,iBAAW,WAAW,YAAY,WAAW,MAAM;AACjD,eAAO,kBAAkB,QAAQ,MAAM,SAAS,MAAM,CAAC;AAAA,MACzD;AAEA,aAAO;AAAA;AAAA,EAEX,CAAC;AAAA;",
10
- "debugId": "A14CF1AD3BCA776264756E2164756E21",
11
- "names": []
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,7 +0,0 @@
1
- export default function createRemotePromise<T = void>(onAwait?: (resolve: (value: T) => void, reject: (error: any) => void) => void | Promise<void>): Promise<T> & {
2
- resolve: (value: T | PromiseLike<T>) => void;
3
- reject: (reason?: any) => void;
4
- promise: Promise<T>;
5
- };
6
- export type RemotePromise<T> = ReturnType<typeof createRemotePromise<T>>;
7
- //# sourceMappingURL=createRemotePromise.d.ts.map
@@ -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"}