@requence/task 1.0.0-alpha.5 → 1.0.0-alpha.50

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 (108) hide show
  1. package/CHANGELOG.md +270 -0
  2. package/README.md +383 -0
  3. package/build/chunk-b4h2we9a.js +35 -0
  4. package/build/chunk-b4h2we9a.js.map +10 -0
  5. package/build/cli.js +21 -4874
  6. package/build/cli.js.map +4 -37
  7. package/build/index.js +1011 -233
  8. package/build/index.js.map +22 -8
  9. package/build/types/helpers/src/files/RequenceFile.d.ts +40 -0
  10. package/build/types/helpers/src/files/RequenceFile.d.ts.map +1 -0
  11. package/build/types/helpers/src/files/RequenceStream.d.ts +32 -0
  12. package/build/types/helpers/src/files/RequenceStream.d.ts.map +1 -0
  13. package/build/types/helpers/src/files/fileObject.d.ts +16 -0
  14. package/build/types/helpers/src/files/fileObject.d.ts.map +1 -0
  15. package/build/types/helpers/src/files/index.d.ts +7 -0
  16. package/build/types/helpers/src/files/index.d.ts.map +1 -0
  17. package/build/types/helpers/src/files/isValidMimeType.d.ts +5 -0
  18. package/build/types/helpers/src/files/isValidMimeType.d.ts.map +1 -0
  19. package/build/types/helpers/src/files/mapOutput.d.ts +10 -0
  20. package/build/types/helpers/src/files/mapOutput.d.ts.map +1 -0
  21. package/build/types/helpers/src/files/streamObject.d.ts +14 -0
  22. package/build/types/helpers/src/files/streamObject.d.ts.map +1 -0
  23. package/build/types/helpers/src/files/types.d.ts +4 -0
  24. package/build/types/helpers/src/files/types.d.ts.map +1 -0
  25. package/build/types/helpers/src/index.d.ts +12 -6
  26. package/build/types/helpers/src/index.d.ts.map +1 -1
  27. package/build/types/helpers/src/jsonschema/mapSchema.d.ts +20 -0
  28. package/build/types/helpers/src/jsonschema/mapSchema.d.ts.map +1 -0
  29. package/build/types/helpers/src/jsonschema/types.d.ts +13 -0
  30. package/build/types/helpers/src/jsonschema/types.d.ts.map +1 -0
  31. package/build/types/helpers/src/jsonschema/validate.d.ts +32 -0
  32. package/build/types/helpers/src/jsonschema/validate.d.ts.map +1 -0
  33. package/build/types/helpers/src/jsonschema/zod.d.ts +17 -0
  34. package/build/types/helpers/src/jsonschema/zod.d.ts.map +1 -0
  35. package/build/types/helpers/src/protocol/NodeTree.d.ts +510 -0
  36. package/build/types/helpers/src/protocol/NodeTree.d.ts.map +1 -0
  37. package/build/types/helpers/src/protocol/command.d.ts +507 -0
  38. package/build/types/helpers/src/protocol/command.d.ts.map +1 -0
  39. package/build/types/helpers/src/protocol/helpers.d.ts +7 -0
  40. package/build/types/helpers/src/protocol/helpers.d.ts.map +1 -0
  41. package/build/types/helpers/src/protocol/index.d.ts +8 -0
  42. package/build/types/helpers/src/protocol/index.d.ts.map +1 -0
  43. package/build/types/helpers/src/protocol/nodeType.d.ts +181 -0
  44. package/build/types/helpers/src/protocol/nodeType.d.ts.map +1 -0
  45. package/build/types/helpers/src/protocol/taskOptions.d.ts +23 -0
  46. package/build/types/helpers/src/protocol/taskOptions.d.ts.map +1 -0
  47. package/build/types/helpers/src/protocol/templateNodeTypes.d.ts +275 -0
  48. package/build/types/helpers/src/protocol/templateNodeTypes.d.ts.map +1 -0
  49. package/build/types/helpers/src/protocol/treeNodes.d.ts +874 -0
  50. package/build/types/helpers/src/protocol/treeNodes.d.ts.map +1 -0
  51. package/build/types/helpers/src/protocol/update.d.ts +406 -0
  52. package/build/types/helpers/src/protocol/update.d.ts.map +1 -0
  53. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts +3 -0
  54. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts.map +1 -0
  55. package/build/types/helpers/src/utils/clone.d.ts +3 -0
  56. package/build/types/helpers/src/utils/clone.d.ts.map +1 -0
  57. package/build/types/helpers/src/utils/createObjectProxy.d.ts +2 -0
  58. package/build/types/helpers/src/utils/createObjectProxy.d.ts.map +1 -0
  59. package/build/types/helpers/src/utils/debounce.d.ts +4 -0
  60. package/build/types/helpers/src/utils/debounce.d.ts.map +1 -0
  61. package/build/types/helpers/src/utils/guards.d.ts +3 -0
  62. package/build/types/helpers/src/utils/guards.d.ts.map +1 -0
  63. package/build/types/helpers/src/utils/mapData.d.ts +18 -0
  64. package/build/types/helpers/src/utils/mapData.d.ts.map +1 -0
  65. package/build/types/helpers/src/{utils.d.ts → utils/matchSchema.d.ts} +2 -2
  66. package/build/types/helpers/src/utils/matchSchema.d.ts.map +1 -0
  67. package/build/types/helpers/src/utils/obfuscate.d.ts.map +1 -0
  68. package/build/types/helpers/src/utils/obj.d.ts +4 -0
  69. package/build/types/helpers/src/utils/obj.d.ts.map +1 -0
  70. package/build/types/helpers/src/utils/requenceCallback.d.ts +17 -0
  71. package/build/types/helpers/src/utils/requenceCallback.d.ts.map +1 -0
  72. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts +8 -0
  73. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts.map +1 -0
  74. package/build/types/helpers/src/utils/types.d.ts +7 -0
  75. package/build/types/helpers/src/utils/types.d.ts.map +1 -0
  76. package/build/types/task/src/abortTask.d.ts +8 -0
  77. package/build/types/task/src/abortTask.d.ts.map +1 -0
  78. package/build/types/task/src/ackTask.d.ts +7 -0
  79. package/build/types/task/src/ackTask.d.ts.map +1 -0
  80. package/build/types/task/src/createTask.d.ts +14 -103
  81. package/build/types/task/src/createTask.d.ts.map +1 -1
  82. package/build/types/task/src/getTask.d.ts +26 -0
  83. package/build/types/task/src/getTask.d.ts.map +1 -0
  84. package/build/types/task/src/index.d.ts +7 -1
  85. package/build/types/task/src/index.d.ts.map +1 -1
  86. package/build/types/task/src/protectTask.d.ts +7 -0
  87. package/build/types/task/src/protectTask.d.ts.map +1 -0
  88. package/build/types/task/src/recreateTask.d.ts +10 -0
  89. package/build/types/task/src/recreateTask.d.ts.map +1 -0
  90. package/build/types/task/src/types.d.ts +196 -941
  91. package/build/types/task/src/types.d.ts.map +1 -1
  92. package/build/types/task/src/utils/getAccessToken.d.ts.map +1 -1
  93. package/build/types/task/src/watchTasks.d.ts +13 -97
  94. package/build/types/task/src/watchTasks.d.ts.map +1 -1
  95. package/package.json +12 -7
  96. package/build/chunk-6pjtq0hg.js +0 -66
  97. package/build/chunk-6pjtq0hg.js.map +0 -12
  98. package/build/types/helpers/src/clone.d.ts +0 -3
  99. package/build/types/helpers/src/clone.d.ts.map +0 -1
  100. package/build/types/helpers/src/createObjectProxy.d.ts +0 -2
  101. package/build/types/helpers/src/createObjectProxy.d.ts.map +0 -1
  102. package/build/types/helpers/src/createRemotePromise.d.ts +0 -7
  103. package/build/types/helpers/src/createRemotePromise.d.ts.map +0 -1
  104. package/build/types/helpers/src/obfuscate.d.ts.map +0 -1
  105. package/build/types/helpers/src/utils.d.ts.map +0 -1
  106. package/build/types/task/src/utils/callbackToAsyncIterator.d.ts +0 -5
  107. package/build/types/task/src/utils/callbackToAsyncIterator.d.ts.map +0 -1
  108. /package/build/types/helpers/src/{obfuscate.d.ts → utils/obfuscate.d.ts} +0 -0
@@ -1,110 +1,21 @@
1
1
  import { type CreateTaskOptions, type Result, type Update } from './types.ts';
2
- export declare class TaskError extends Error {
2
+ declare class TaskPrepareError extends Error {
3
3
  readonly taskTemplate: string;
4
4
  constructor(message: string, taskTemplate: string);
5
5
  }
6
- type TaskUpdateHandler = (update: Update) => void;
7
- export declare function createTask<T extends keyof Requence.TaskTemplate | (string & {})>(options: CreateTaskOptions<T>, onUpdate?: TaskUpdateHandler): Promise<Result<T>> & AsyncIterable<{
8
- type: "taskStart";
9
- timestamp: Date;
10
- taskId: string;
11
- input?: unknown;
12
- meta?: unknown;
13
- } | {
14
- type: "taskError";
15
- timestamp: Date;
16
- taskId: string;
17
- error: string;
18
- } | {
19
- type: "taskEnd";
20
- timestamp: Date;
21
- taskId: string;
22
- result: Record<string, unknown>;
23
- partialResults: {
24
- timestamp: Date | null;
25
- node: {
26
- type: "service";
27
- id: string;
28
- service?: {
29
- id: string;
30
- name: string;
31
- version: string;
32
- } | undefined;
33
- alias?: string | undefined;
34
- } | {
35
- type: "logic";
36
- id: string;
37
- alias?: string | undefined;
38
- logic?: {
39
- language: "typescript" | "javascript" | "python";
40
- } | undefined;
41
- };
42
- error?: string | undefined;
43
- data?: unknown;
44
- }[];
45
- } | {
46
- type: "nodeStart";
47
- timestamp: Date;
48
- taskId: string;
49
- node: {
50
- type: "service";
51
- id: string;
52
- service?: {
53
- id: string;
54
- name: string;
55
- version: string;
56
- } | undefined;
57
- alias?: string | undefined;
58
- } | {
59
- type: "logic";
60
- id: string;
61
- alias?: string | undefined;
62
- logic?: {
63
- language: "typescript" | "javascript" | "python";
64
- } | undefined;
65
- };
66
- } | {
67
- type: "nodeUpdate";
68
- timestamp: Date;
69
- taskId: string;
70
- data?: unknown;
71
- } | {
72
- type: "nodeError";
73
- timestamp: Date;
74
- taskId: string;
75
- error: string;
76
- } | {
77
- type: "nodeDefer";
78
- timestamp: Date;
79
- taskId: string;
80
- reason?: string | undefined;
81
- } | {
82
- type: "nodeEnd";
83
- timestamp: Date;
84
- taskId: string;
85
- node: {
86
- type: "service";
87
- id: string;
88
- service?: {
89
- id: string;
90
- name: string;
91
- version: string;
92
- } | undefined;
93
- alias?: string | undefined;
94
- } | {
95
- type: "logic";
96
- id: string;
97
- alias?: string | undefined;
98
- logic?: {
99
- language: "typescript" | "javascript" | "python";
100
- } | undefined;
101
- };
102
- }> & {
103
- getTaskId(): Promise<string> & {
104
- resolve: (value: string | PromiseLike<string>) => void;
105
- reject: (reason?: any) => void;
106
- promise: Promise<string>;
107
- };
6
+ export declare class TaskError extends TaskPrepareError {
7
+ readonly taskTemplate: string;
8
+ readonly taskId: string;
9
+ constructor(message: string, taskTemplate: string, taskId: string);
10
+ }
11
+ type TaskUpdateHandler<T> = (update: Update<T>) => void;
12
+ type Task<T extends keyof RequenceTask.TaskTemplate | (string & {})> = AsyncIterable<Update<T>> & Pick<Promise<Result<T>>, 'then' | 'catch' | 'finally'> & {
13
+ getTaskId(): Promise<string>;
14
+ getTaskUrl(): Promise<string | null>;
15
+ abort(reason?: string): Promise<void>;
16
+ protect(): Promise<void>;
17
+ finalized(): Promise<string>;
108
18
  };
19
+ export declare function createTask<T extends keyof RequenceTask.TaskTemplate | (string & {})>(options: CreateTaskOptions<T>, onUpdate?: TaskUpdateHandler<T>): Task<T>;
109
20
  export {};
110
21
  //# sourceMappingURL=createTask.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createTask.d.ts","sourceRoot":"","sources":["../../../../src/createTask.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,KAAK,MAAM,EAEZ,MAAM,YAAY,CAAA;AAInB,qBAAa,SAAU,SAAQ,KAAK;aAGhB,YAAY,EAAE,MAAM;gBADpC,OAAO,EAAE,MAAM,EACC,YAAY,EAAE,MAAM;CAIvC;AAED,KAAK,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;AAEjD,wBAAgB,UAAU,CACxB,CAAC,SAAS,MAAM,QAAQ,CAAC,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EACrD,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgL5D"}
1
+ {"version":3,"file":"createTask.d.ts","sourceRoot":"","sources":["../../../../src/createTask.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,KAAK,MAAM,EAGZ,MAAM,YAAY,CAAA;AAGnB,cAAM,gBAAiB,SAAQ,KAAK;aAGhB,YAAY,EAAE,MAAM;gBADpC,OAAO,EAAE,MAAM,EACC,YAAY,EAAE,MAAM;CAIvC;AAED,qBAAa,SAAU,SAAQ,gBAAgB;aAG3B,YAAY,EAAE,MAAM;aACpB,MAAM,EAAE,MAAM;gBAF9B,OAAO,EAAE,MAAM,EACC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM;CAIjC;AAED,KAAK,iBAAiB,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;AAEvD,KAAK,IAAI,CAAC,CAAC,SAAS,MAAM,YAAY,CAAC,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,IACjE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GACtB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GAAG;IACvD,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IAC5B,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACpC,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACxB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;CAC7B,CAAA;AAEL,wBAAgB,UAAU,CACxB,CAAC,SAAS,MAAM,YAAY,CAAC,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EACzD,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAsXzE"}
@@ -0,0 +1,26 @@
1
+ interface GetTaskOptions {
2
+ accessToken?: string;
3
+ taskId: string;
4
+ }
5
+ export declare function getTask(taskIdOrOptions: string | GetTaskOptions): Promise<{
6
+ status: "SUCCESSFUL" | "FAILED" | "IDLE" | "PENDING" | "RUNNING" | "STOPPED" | "AWAITING_DELIVERY";
7
+ statusText: string | null;
8
+ taskTemplate: string;
9
+ name: string;
10
+ branch: (string & {}) | "live";
11
+ context: {
12
+ input: unknown;
13
+ taskId: string;
14
+ result: unknown;
15
+ getNodeData: <A extends string>(alias: A) => unknown;
16
+ getNodeError: (alias: string) => string | null;
17
+ } | {
18
+ input: unknown;
19
+ taskId: string;
20
+ result: unknown;
21
+ getNodeData: <A extends string>(alias: A) => unknown;
22
+ getNodeError: (alias: string) => string | null;
23
+ };
24
+ }>;
25
+ export {};
26
+ //# sourceMappingURL=getTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTask.d.ts","sourceRoot":"","sources":["../../../../src/getTask.ts"],"names":[],"mappings":"AA4BA,UAAU,cAAc;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,OAAO,CAAC,eAAe,EAAE,MAAM,GAAG,cAAc;;;;;;;;;;;;;;;;;;;GA+CrE"}
@@ -1,3 +1,9 @@
1
- export { createTask } from './createTask.ts';
1
+ export { createTask, TaskError } from './createTask.ts';
2
2
  export { watchTasks } from './watchTasks.ts';
3
+ export { abortTask } from './abortTask.ts';
4
+ export { protectTask } from './protectTask.ts';
5
+ export { getTask } from './getTask.ts';
6
+ export { RequenceFile, RequenceStream } from '../../helpers/src/files/index.js';
7
+ export { type RequenceCallback } from '../../helpers/src/index.js';
8
+ export { recreateTask } from './recreateTask.ts';
3
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,7 @@
1
+ interface ProtectTaskOptions {
2
+ accessToken?: string;
3
+ taskId: string;
4
+ }
5
+ export declare function protectTask(options: ProtectTaskOptions): Promise<void>;
6
+ export {};
7
+ //# sourceMappingURL=protectTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protectTask.d.ts","sourceRoot":"","sources":["../../../../src/protectTask.ts"],"names":[],"mappings":"AAWA,UAAU,kBAAkB;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;CACf;AACD,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,iBAe5D"}
@@ -0,0 +1,10 @@
1
+ import { createTask } from './createTask.ts';
2
+ interface RecreateTaskOptions {
3
+ taskId: string;
4
+ name?: string;
5
+ accessToken?: string;
6
+ priority?: number;
7
+ }
8
+ export declare function recreateTask(options: RecreateTaskOptions, onUpdate?: Parameters<typeof createTask>[1]): Promise<import("./types.ts").Result<string & {}>>;
9
+ export {};
10
+ //# sourceMappingURL=recreateTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recreateTask.d.ts","sourceRoot":"","sources":["../../../../src/recreateTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AACD,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,EAC5B,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,qDAa5C"}