@viu/emporix-sdk 3.3.1 → 3.4.1
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/CHANGELOG.md +55 -0
- package/dist/index.cjs +53 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +108 -6
- package/dist/index.d.ts +108 -6
- package/dist/index.js +53 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2124,7 +2124,7 @@ type IdResponse$1 = {
|
|
|
2124
2124
|
/**
|
|
2125
2125
|
* Type which the schema should be assigned to. Can be one of the predefined values or any custom schema type id.
|
|
2126
2126
|
*/
|
|
2127
|
-
type SchemaType = 'AVAILABILITY' | 'CART' | 'CART_ITEM' | 'CATEGORY' | 'COMPANY' | 'COUPON' | 'CUSTOMER' | 'CUSTOMER_ADDRESS' | 'LOCATION' | 'ORDER' | 'ORDER_ENTRY' | 'PRODUCT' | 'QUOTE' | 'RETURN' | 'PRICE_LIST' | 'SITE' | 'CUSTOM_ENTITY' | 'VENDOR' | 'MEDIA';
|
|
2127
|
+
type SchemaType = 'AVAILABILITY' | 'CART' | 'CART_ITEM' | 'CATEGORY' | 'COMPANY' | 'COUPON' | 'CUSTOMER' | 'CUSTOMER_ADDRESS' | 'LOCATION' | 'ORDER' | 'ORDER_ENTRY' | 'PRODUCT' | 'QUOTE' | 'RETURN' | 'PRICE_LIST' | 'SITE' | 'CUSTOM_ENTITY' | 'VENDOR' | 'VENDOR_LOCATION' | 'MEDIA';
|
|
2128
2128
|
/**
|
|
2129
2129
|
* Type of the attribute.
|
|
2130
2130
|
*
|
|
@@ -9116,6 +9116,33 @@ type ImportRun$1 = {
|
|
|
9116
9116
|
* What triggered the run.
|
|
9117
9117
|
*/
|
|
9118
9118
|
trigger?: 'MANUAL' | 'SCHEDULED';
|
|
9119
|
+
/**
|
|
9120
|
+
* Dry-run only. A sample of the mapped records that would be written, so the mapping can be previewed without a real import. Absent on normal runs.
|
|
9121
|
+
*/
|
|
9122
|
+
dryRunSample?: Array<{
|
|
9123
|
+
/**
|
|
9124
|
+
* The stream that produced the sample record.
|
|
9125
|
+
*/
|
|
9126
|
+
stream?: string;
|
|
9127
|
+
/**
|
|
9128
|
+
* The resolved target type the record would be written to.
|
|
9129
|
+
*/
|
|
9130
|
+
targetType?: string;
|
|
9131
|
+
/**
|
|
9132
|
+
* The record's natural/deterministic key.
|
|
9133
|
+
*/
|
|
9134
|
+
key?: string;
|
|
9135
|
+
/**
|
|
9136
|
+
* The mapped target fields that would be written.
|
|
9137
|
+
*/
|
|
9138
|
+
fields?: {
|
|
9139
|
+
[key: string]: unknown;
|
|
9140
|
+
};
|
|
9141
|
+
}>;
|
|
9142
|
+
/**
|
|
9143
|
+
* What requested the run. The `origin` value from the trigger request, or the `trigger` value when `origin` was omitted. Use this field to distinguish a dashboard run from a run started by an integration scenario. The field is absent on runs recorded before it existed.
|
|
9144
|
+
*/
|
|
9145
|
+
origin?: string;
|
|
9119
9146
|
/**
|
|
9120
9147
|
* The run status.
|
|
9121
9148
|
*/
|
|
@@ -9727,6 +9754,14 @@ type PostImporttoolTriggerRunData = {
|
|
|
9727
9754
|
* When `true`, every extracted record is rewritten, even if unchanged. It bypasses the idempotency `skip-if-unchanged` check. Use it to force target IDs and values to be rewritten.
|
|
9728
9755
|
*/
|
|
9729
9756
|
force?: boolean;
|
|
9757
|
+
/**
|
|
9758
|
+
* Dry-run only. How many mapped records to sample per stream for the preview returned as `dryRunSample`. Clamped to 1-100; defaults to 25.
|
|
9759
|
+
*/
|
|
9760
|
+
sampleSize?: number;
|
|
9761
|
+
/**
|
|
9762
|
+
* What requested this run. Examples: `Dashboard`, an integration scenario name, or a scheduler name. The `trigger` field records only `MANUAL` or `SCHEDULED`. Use `origin` when more than one system calls this endpoint. If you omit `origin` or send a blank value, the service stores the `trigger` value. The service rejects values longer than 40 characters and values that contain control characters. It does not shorten them.
|
|
9763
|
+
*/
|
|
9764
|
+
origin?: string;
|
|
9730
9765
|
};
|
|
9731
9766
|
path: {
|
|
9732
9767
|
/**
|
|
@@ -9832,7 +9867,19 @@ type ImportConfig = ImportConfig$1;
|
|
|
9832
9867
|
type ImportStream = ImportStream$1;
|
|
9833
9868
|
/** A cron schedule for a configuration. `cron` is a six-field Spring expression. */
|
|
9834
9869
|
type ImportSchedule = Schedule;
|
|
9835
|
-
/**
|
|
9870
|
+
/**
|
|
9871
|
+
* An import run with its reconciled counters.
|
|
9872
|
+
*
|
|
9873
|
+
* Two counters describe the **source feed** rather than the import: a run can
|
|
9874
|
+
* report `SUCCEEDED` while `duplicateKeys` (source rows repeating a key already
|
|
9875
|
+
* imported in the run — only the last survives) and `unresolvedParents` (child
|
|
9876
|
+
* records whose parent was not found, distinct from `skipped`, which means
|
|
9877
|
+
* already up to date) hide real data loss from the pass/fail counters.
|
|
9878
|
+
*
|
|
9879
|
+
* `dryRunSample` carries the previewed records on a dry run and is absent on a
|
|
9880
|
+
* normal one. `origin` echoes what asked for the run, and is absent on runs
|
|
9881
|
+
* recorded before that field existed.
|
|
9882
|
+
*/
|
|
9836
9883
|
type ImportRun = ImportRun$1;
|
|
9837
9884
|
/** Per-stream progress within a run. */
|
|
9838
9885
|
type ImportRunStream = ImportRunStream$1;
|
|
@@ -9845,9 +9892,19 @@ type ImportErrorRecord = ErrorRecord;
|
|
|
9845
9892
|
/** A record that was imported, with its keys, stored fields and last outcome. */
|
|
9846
9893
|
type ImportedRecord = ImportedRecord$1;
|
|
9847
9894
|
/**
|
|
9848
|
-
* Body for `triggerRun`: `{ mode?, dryRun?, force? }`.
|
|
9849
|
-
*
|
|
9850
|
-
*
|
|
9895
|
+
* Body for `triggerRun`: `{ mode?, dryRun?, force?, sampleSize?, origin? }`.
|
|
9896
|
+
*
|
|
9897
|
+
* - `mode` defaults to `DELTA` server-side.
|
|
9898
|
+
* - `force` rewrites every extracted record, bypassing the skip-if-unchanged
|
|
9899
|
+
* idempotency.
|
|
9900
|
+
* - `sampleSize` is **dry-run only**: how many mapped records to sample per
|
|
9901
|
+
* stream into the run's `dryRunSample`. Clamped to 1–100, defaults to 25.
|
|
9902
|
+
* - `origin` is free text naming *what* asked for the run (`"Dashboard"`, an
|
|
9903
|
+
* integration scenario, your own scheduler), as opposed to `trigger`, which
|
|
9904
|
+
* only ever records `MANUAL` or `SCHEDULED`. Omitted or blank, the service
|
|
9905
|
+
* stores the `trigger` value instead. **Over 40 characters or containing
|
|
9906
|
+
* control characters is rejected, not shortened** — a truncated label in an
|
|
9907
|
+
* audit trail is worse than a refused request.
|
|
9851
9908
|
*/
|
|
9852
9909
|
type ImportRunInput = NonNullable<PostImporttoolTriggerRunData["body"]>;
|
|
9853
9910
|
/** Lifecycle status of an {@link ImportRun}. */
|
|
@@ -9988,13 +10045,58 @@ declare class ImportService {
|
|
|
9988
10045
|
* a normal result rather than an error.
|
|
9989
10046
|
*/
|
|
9990
10047
|
getSchedule(configId: string, auth?: AuthContext): Promise<ImportSchedule | null>;
|
|
9991
|
-
/**
|
|
10048
|
+
/**
|
|
10049
|
+
* Create or replace a configuration's schedule.
|
|
10050
|
+
*
|
|
10051
|
+
* **`cron` is a six-field Spring expression** (`second minute hour
|
|
10052
|
+
* day-of-month month day-of-week`). The familiar five-field `"0 * * * *"` is
|
|
10053
|
+
* not «hourly» here, it is invalid, and the service answers `400` rather than
|
|
10054
|
+
* storing it — which it used to do, leaving a schedule that silently never
|
|
10055
|
+
* fired.
|
|
10056
|
+
*
|
|
10057
|
+
* A `404` means no configuration with that id, so there is nothing to
|
|
10058
|
+
* schedule. Use {@link deleteSchedule} to clear a schedule that outlived its
|
|
10059
|
+
* configuration.
|
|
10060
|
+
*/
|
|
9992
10061
|
setSchedule(configId: string, input: ImportSchedule, auth?: AuthContext): Promise<ImportSchedule>;
|
|
10062
|
+
/**
|
|
10063
|
+
* Remove a configuration's schedule. It then runs only when triggered.
|
|
10064
|
+
*
|
|
10065
|
+
* **Idempotent, and deliberately not gated on the configuration existing.**
|
|
10066
|
+
* Removing a schedule that is not there also resolves — and unlike
|
|
10067
|
+
* {@link setSchedule}, this does not require the configuration to exist. That
|
|
10068
|
+
* is the point: a schedule left behind by a deleted configuration is exactly
|
|
10069
|
+
* what needs removing, so refusing those would leave them with no way out.
|
|
10070
|
+
*
|
|
10071
|
+
* The service answers `204`, so this resolves to `void` rather than to the
|
|
10072
|
+
* removed schedule.
|
|
10073
|
+
*/
|
|
10074
|
+
deleteSchedule(configId: string, auth?: AuthContext): Promise<void>;
|
|
9993
10075
|
/**
|
|
9994
10076
|
* Trigger a run. `mode` defaults to `DELTA` server-side; `dryRun: true` maps
|
|
9995
10077
|
* and validates without writing to the target.
|
|
9996
10078
|
*
|
|
10079
|
+
* A dry run can also hand back what it *would* have written: pass
|
|
10080
|
+
* `sampleSize` (1–100, default 25) and read the run's `dryRunSample`. Set
|
|
10081
|
+
* `origin` to name what asked for the run — `trigger` only distinguishes
|
|
10082
|
+
* `MANUAL` from `SCHEDULED`, so without it a dashboard click and an
|
|
10083
|
+
* integration scenario are indistinguishable in the history. Note the service
|
|
10084
|
+
* **rejects** an `origin` over 40 characters instead of shortening it.
|
|
10085
|
+
*
|
|
9997
10086
|
* Not retried on a 5xx: a POST that timed out may already have queued a run.
|
|
10087
|
+
*
|
|
10088
|
+
* @example
|
|
10089
|
+
* ```ts
|
|
10090
|
+
* // Preview the mapping without writing anything.
|
|
10091
|
+
* const run = await client.imports.triggerRun(configId, {
|
|
10092
|
+
* dryRun: true,
|
|
10093
|
+
* sampleSize: 5,
|
|
10094
|
+
* origin: "Dashboard",
|
|
10095
|
+
* });
|
|
10096
|
+
* for (const row of run.dryRunSample ?? []) {
|
|
10097
|
+
* console.log(row.stream, row.targetType, row.key, row.fields);
|
|
10098
|
+
* }
|
|
10099
|
+
* ```
|
|
9998
10100
|
*/
|
|
9999
10101
|
triggerRun(configId: string, input?: ImportRunInput, auth?: AuthContext): Promise<ImportRun>;
|
|
10000
10102
|
/** List a configuration's runs, newest first. */
|
package/dist/index.d.ts
CHANGED
|
@@ -2124,7 +2124,7 @@ type IdResponse$1 = {
|
|
|
2124
2124
|
/**
|
|
2125
2125
|
* Type which the schema should be assigned to. Can be one of the predefined values or any custom schema type id.
|
|
2126
2126
|
*/
|
|
2127
|
-
type SchemaType = 'AVAILABILITY' | 'CART' | 'CART_ITEM' | 'CATEGORY' | 'COMPANY' | 'COUPON' | 'CUSTOMER' | 'CUSTOMER_ADDRESS' | 'LOCATION' | 'ORDER' | 'ORDER_ENTRY' | 'PRODUCT' | 'QUOTE' | 'RETURN' | 'PRICE_LIST' | 'SITE' | 'CUSTOM_ENTITY' | 'VENDOR' | 'MEDIA';
|
|
2127
|
+
type SchemaType = 'AVAILABILITY' | 'CART' | 'CART_ITEM' | 'CATEGORY' | 'COMPANY' | 'COUPON' | 'CUSTOMER' | 'CUSTOMER_ADDRESS' | 'LOCATION' | 'ORDER' | 'ORDER_ENTRY' | 'PRODUCT' | 'QUOTE' | 'RETURN' | 'PRICE_LIST' | 'SITE' | 'CUSTOM_ENTITY' | 'VENDOR' | 'VENDOR_LOCATION' | 'MEDIA';
|
|
2128
2128
|
/**
|
|
2129
2129
|
* Type of the attribute.
|
|
2130
2130
|
*
|
|
@@ -9116,6 +9116,33 @@ type ImportRun$1 = {
|
|
|
9116
9116
|
* What triggered the run.
|
|
9117
9117
|
*/
|
|
9118
9118
|
trigger?: 'MANUAL' | 'SCHEDULED';
|
|
9119
|
+
/**
|
|
9120
|
+
* Dry-run only. A sample of the mapped records that would be written, so the mapping can be previewed without a real import. Absent on normal runs.
|
|
9121
|
+
*/
|
|
9122
|
+
dryRunSample?: Array<{
|
|
9123
|
+
/**
|
|
9124
|
+
* The stream that produced the sample record.
|
|
9125
|
+
*/
|
|
9126
|
+
stream?: string;
|
|
9127
|
+
/**
|
|
9128
|
+
* The resolved target type the record would be written to.
|
|
9129
|
+
*/
|
|
9130
|
+
targetType?: string;
|
|
9131
|
+
/**
|
|
9132
|
+
* The record's natural/deterministic key.
|
|
9133
|
+
*/
|
|
9134
|
+
key?: string;
|
|
9135
|
+
/**
|
|
9136
|
+
* The mapped target fields that would be written.
|
|
9137
|
+
*/
|
|
9138
|
+
fields?: {
|
|
9139
|
+
[key: string]: unknown;
|
|
9140
|
+
};
|
|
9141
|
+
}>;
|
|
9142
|
+
/**
|
|
9143
|
+
* What requested the run. The `origin` value from the trigger request, or the `trigger` value when `origin` was omitted. Use this field to distinguish a dashboard run from a run started by an integration scenario. The field is absent on runs recorded before it existed.
|
|
9144
|
+
*/
|
|
9145
|
+
origin?: string;
|
|
9119
9146
|
/**
|
|
9120
9147
|
* The run status.
|
|
9121
9148
|
*/
|
|
@@ -9727,6 +9754,14 @@ type PostImporttoolTriggerRunData = {
|
|
|
9727
9754
|
* When `true`, every extracted record is rewritten, even if unchanged. It bypasses the idempotency `skip-if-unchanged` check. Use it to force target IDs and values to be rewritten.
|
|
9728
9755
|
*/
|
|
9729
9756
|
force?: boolean;
|
|
9757
|
+
/**
|
|
9758
|
+
* Dry-run only. How many mapped records to sample per stream for the preview returned as `dryRunSample`. Clamped to 1-100; defaults to 25.
|
|
9759
|
+
*/
|
|
9760
|
+
sampleSize?: number;
|
|
9761
|
+
/**
|
|
9762
|
+
* What requested this run. Examples: `Dashboard`, an integration scenario name, or a scheduler name. The `trigger` field records only `MANUAL` or `SCHEDULED`. Use `origin` when more than one system calls this endpoint. If you omit `origin` or send a blank value, the service stores the `trigger` value. The service rejects values longer than 40 characters and values that contain control characters. It does not shorten them.
|
|
9763
|
+
*/
|
|
9764
|
+
origin?: string;
|
|
9730
9765
|
};
|
|
9731
9766
|
path: {
|
|
9732
9767
|
/**
|
|
@@ -9832,7 +9867,19 @@ type ImportConfig = ImportConfig$1;
|
|
|
9832
9867
|
type ImportStream = ImportStream$1;
|
|
9833
9868
|
/** A cron schedule for a configuration. `cron` is a six-field Spring expression. */
|
|
9834
9869
|
type ImportSchedule = Schedule;
|
|
9835
|
-
/**
|
|
9870
|
+
/**
|
|
9871
|
+
* An import run with its reconciled counters.
|
|
9872
|
+
*
|
|
9873
|
+
* Two counters describe the **source feed** rather than the import: a run can
|
|
9874
|
+
* report `SUCCEEDED` while `duplicateKeys` (source rows repeating a key already
|
|
9875
|
+
* imported in the run — only the last survives) and `unresolvedParents` (child
|
|
9876
|
+
* records whose parent was not found, distinct from `skipped`, which means
|
|
9877
|
+
* already up to date) hide real data loss from the pass/fail counters.
|
|
9878
|
+
*
|
|
9879
|
+
* `dryRunSample` carries the previewed records on a dry run and is absent on a
|
|
9880
|
+
* normal one. `origin` echoes what asked for the run, and is absent on runs
|
|
9881
|
+
* recorded before that field existed.
|
|
9882
|
+
*/
|
|
9836
9883
|
type ImportRun = ImportRun$1;
|
|
9837
9884
|
/** Per-stream progress within a run. */
|
|
9838
9885
|
type ImportRunStream = ImportRunStream$1;
|
|
@@ -9845,9 +9892,19 @@ type ImportErrorRecord = ErrorRecord;
|
|
|
9845
9892
|
/** A record that was imported, with its keys, stored fields and last outcome. */
|
|
9846
9893
|
type ImportedRecord = ImportedRecord$1;
|
|
9847
9894
|
/**
|
|
9848
|
-
* Body for `triggerRun`: `{ mode?, dryRun?, force? }`.
|
|
9849
|
-
*
|
|
9850
|
-
*
|
|
9895
|
+
* Body for `triggerRun`: `{ mode?, dryRun?, force?, sampleSize?, origin? }`.
|
|
9896
|
+
*
|
|
9897
|
+
* - `mode` defaults to `DELTA` server-side.
|
|
9898
|
+
* - `force` rewrites every extracted record, bypassing the skip-if-unchanged
|
|
9899
|
+
* idempotency.
|
|
9900
|
+
* - `sampleSize` is **dry-run only**: how many mapped records to sample per
|
|
9901
|
+
* stream into the run's `dryRunSample`. Clamped to 1–100, defaults to 25.
|
|
9902
|
+
* - `origin` is free text naming *what* asked for the run (`"Dashboard"`, an
|
|
9903
|
+
* integration scenario, your own scheduler), as opposed to `trigger`, which
|
|
9904
|
+
* only ever records `MANUAL` or `SCHEDULED`. Omitted or blank, the service
|
|
9905
|
+
* stores the `trigger` value instead. **Over 40 characters or containing
|
|
9906
|
+
* control characters is rejected, not shortened** — a truncated label in an
|
|
9907
|
+
* audit trail is worse than a refused request.
|
|
9851
9908
|
*/
|
|
9852
9909
|
type ImportRunInput = NonNullable<PostImporttoolTriggerRunData["body"]>;
|
|
9853
9910
|
/** Lifecycle status of an {@link ImportRun}. */
|
|
@@ -9988,13 +10045,58 @@ declare class ImportService {
|
|
|
9988
10045
|
* a normal result rather than an error.
|
|
9989
10046
|
*/
|
|
9990
10047
|
getSchedule(configId: string, auth?: AuthContext): Promise<ImportSchedule | null>;
|
|
9991
|
-
/**
|
|
10048
|
+
/**
|
|
10049
|
+
* Create or replace a configuration's schedule.
|
|
10050
|
+
*
|
|
10051
|
+
* **`cron` is a six-field Spring expression** (`second minute hour
|
|
10052
|
+
* day-of-month month day-of-week`). The familiar five-field `"0 * * * *"` is
|
|
10053
|
+
* not «hourly» here, it is invalid, and the service answers `400` rather than
|
|
10054
|
+
* storing it — which it used to do, leaving a schedule that silently never
|
|
10055
|
+
* fired.
|
|
10056
|
+
*
|
|
10057
|
+
* A `404` means no configuration with that id, so there is nothing to
|
|
10058
|
+
* schedule. Use {@link deleteSchedule} to clear a schedule that outlived its
|
|
10059
|
+
* configuration.
|
|
10060
|
+
*/
|
|
9992
10061
|
setSchedule(configId: string, input: ImportSchedule, auth?: AuthContext): Promise<ImportSchedule>;
|
|
10062
|
+
/**
|
|
10063
|
+
* Remove a configuration's schedule. It then runs only when triggered.
|
|
10064
|
+
*
|
|
10065
|
+
* **Idempotent, and deliberately not gated on the configuration existing.**
|
|
10066
|
+
* Removing a schedule that is not there also resolves — and unlike
|
|
10067
|
+
* {@link setSchedule}, this does not require the configuration to exist. That
|
|
10068
|
+
* is the point: a schedule left behind by a deleted configuration is exactly
|
|
10069
|
+
* what needs removing, so refusing those would leave them with no way out.
|
|
10070
|
+
*
|
|
10071
|
+
* The service answers `204`, so this resolves to `void` rather than to the
|
|
10072
|
+
* removed schedule.
|
|
10073
|
+
*/
|
|
10074
|
+
deleteSchedule(configId: string, auth?: AuthContext): Promise<void>;
|
|
9993
10075
|
/**
|
|
9994
10076
|
* Trigger a run. `mode` defaults to `DELTA` server-side; `dryRun: true` maps
|
|
9995
10077
|
* and validates without writing to the target.
|
|
9996
10078
|
*
|
|
10079
|
+
* A dry run can also hand back what it *would* have written: pass
|
|
10080
|
+
* `sampleSize` (1–100, default 25) and read the run's `dryRunSample`. Set
|
|
10081
|
+
* `origin` to name what asked for the run — `trigger` only distinguishes
|
|
10082
|
+
* `MANUAL` from `SCHEDULED`, so without it a dashboard click and an
|
|
10083
|
+
* integration scenario are indistinguishable in the history. Note the service
|
|
10084
|
+
* **rejects** an `origin` over 40 characters instead of shortening it.
|
|
10085
|
+
*
|
|
9997
10086
|
* Not retried on a 5xx: a POST that timed out may already have queued a run.
|
|
10087
|
+
*
|
|
10088
|
+
* @example
|
|
10089
|
+
* ```ts
|
|
10090
|
+
* // Preview the mapping without writing anything.
|
|
10091
|
+
* const run = await client.imports.triggerRun(configId, {
|
|
10092
|
+
* dryRun: true,
|
|
10093
|
+
* sampleSize: 5,
|
|
10094
|
+
* origin: "Dashboard",
|
|
10095
|
+
* });
|
|
10096
|
+
* for (const row of run.dryRunSample ?? []) {
|
|
10097
|
+
* console.log(row.stream, row.targetType, row.key, row.fields);
|
|
10098
|
+
* }
|
|
10099
|
+
* ```
|
|
9998
10100
|
*/
|
|
9999
10101
|
triggerRun(configId: string, input?: ImportRunInput, auth?: AuthContext): Promise<ImportRun>;
|
|
10000
10102
|
/** List a configuration's runs, newest first. */
|
package/dist/index.js
CHANGED
|
@@ -945,7 +945,7 @@ var HttpClient = class {
|
|
|
945
945
|
};
|
|
946
946
|
|
|
947
947
|
// package.json
|
|
948
|
-
var version = "3.
|
|
948
|
+
var version = "3.4.1";
|
|
949
949
|
|
|
950
950
|
// src/version.ts
|
|
951
951
|
var SDK_VERSION = version;
|
|
@@ -4330,7 +4330,19 @@ var ImportService = class {
|
|
|
4330
4330
|
});
|
|
4331
4331
|
return res ?? null;
|
|
4332
4332
|
}
|
|
4333
|
-
/**
|
|
4333
|
+
/**
|
|
4334
|
+
* Create or replace a configuration's schedule.
|
|
4335
|
+
*
|
|
4336
|
+
* **`cron` is a six-field Spring expression** (`second minute hour
|
|
4337
|
+
* day-of-month month day-of-week`). The familiar five-field `"0 * * * *"` is
|
|
4338
|
+
* not «hourly» here, it is invalid, and the service answers `400` rather than
|
|
4339
|
+
* storing it — which it used to do, leaving a schedule that silently never
|
|
4340
|
+
* fired.
|
|
4341
|
+
*
|
|
4342
|
+
* A `404` means no configuration with that id, so there is nothing to
|
|
4343
|
+
* schedule. Use {@link deleteSchedule} to clear a schedule that outlived its
|
|
4344
|
+
* configuration.
|
|
4345
|
+
*/
|
|
4334
4346
|
async setSchedule(configId, input, auth2 = SERVICE22) {
|
|
4335
4347
|
return this.ctx.http.request({
|
|
4336
4348
|
method: "PUT",
|
|
@@ -4339,11 +4351,50 @@ var ImportService = class {
|
|
|
4339
4351
|
auth: auth2
|
|
4340
4352
|
});
|
|
4341
4353
|
}
|
|
4354
|
+
/**
|
|
4355
|
+
* Remove a configuration's schedule. It then runs only when triggered.
|
|
4356
|
+
*
|
|
4357
|
+
* **Idempotent, and deliberately not gated on the configuration existing.**
|
|
4358
|
+
* Removing a schedule that is not there also resolves — and unlike
|
|
4359
|
+
* {@link setSchedule}, this does not require the configuration to exist. That
|
|
4360
|
+
* is the point: a schedule left behind by a deleted configuration is exactly
|
|
4361
|
+
* what needs removing, so refusing those would leave them with no way out.
|
|
4362
|
+
*
|
|
4363
|
+
* The service answers `204`, so this resolves to `void` rather than to the
|
|
4364
|
+
* removed schedule.
|
|
4365
|
+
*/
|
|
4366
|
+
async deleteSchedule(configId, auth2 = SERVICE22) {
|
|
4367
|
+
await this.ctx.http.request({
|
|
4368
|
+
method: "DELETE",
|
|
4369
|
+
path: `${this.base()}/configs/${encodeURIComponent(configId)}/schedule`,
|
|
4370
|
+
auth: auth2
|
|
4371
|
+
});
|
|
4372
|
+
}
|
|
4342
4373
|
/**
|
|
4343
4374
|
* Trigger a run. `mode` defaults to `DELTA` server-side; `dryRun: true` maps
|
|
4344
4375
|
* and validates without writing to the target.
|
|
4345
4376
|
*
|
|
4377
|
+
* A dry run can also hand back what it *would* have written: pass
|
|
4378
|
+
* `sampleSize` (1–100, default 25) and read the run's `dryRunSample`. Set
|
|
4379
|
+
* `origin` to name what asked for the run — `trigger` only distinguishes
|
|
4380
|
+
* `MANUAL` from `SCHEDULED`, so without it a dashboard click and an
|
|
4381
|
+
* integration scenario are indistinguishable in the history. Note the service
|
|
4382
|
+
* **rejects** an `origin` over 40 characters instead of shortening it.
|
|
4383
|
+
*
|
|
4346
4384
|
* Not retried on a 5xx: a POST that timed out may already have queued a run.
|
|
4385
|
+
*
|
|
4386
|
+
* @example
|
|
4387
|
+
* ```ts
|
|
4388
|
+
* // Preview the mapping without writing anything.
|
|
4389
|
+
* const run = await client.imports.triggerRun(configId, {
|
|
4390
|
+
* dryRun: true,
|
|
4391
|
+
* sampleSize: 5,
|
|
4392
|
+
* origin: "Dashboard",
|
|
4393
|
+
* });
|
|
4394
|
+
* for (const row of run.dryRunSample ?? []) {
|
|
4395
|
+
* console.log(row.stream, row.targetType, row.key, row.fields);
|
|
4396
|
+
* }
|
|
4397
|
+
* ```
|
|
4347
4398
|
*/
|
|
4348
4399
|
async triggerRun(configId, input = {}, auth2 = SERVICE22) {
|
|
4349
4400
|
return this.ctx.http.request({
|