@antcde/connect-ts 0.4.27-rc.3 → 0.4.27-rc.4

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 (79) hide show
  1. package/build/comms/client.d.ts.map +1 -1
  2. package/build/comms/client.js +39 -41
  3. package/build/comms/connection.d.ts +32 -0
  4. package/build/comms/connection.d.ts.map +1 -0
  5. package/build/comms/connection.js +159 -0
  6. package/build/comms/handshake.d.ts +16 -0
  7. package/build/comms/handshake.d.ts.map +1 -0
  8. package/build/comms/handshake.js +73 -0
  9. package/build/comms/host.d.ts.map +1 -1
  10. package/build/comms/host.js +22 -26
  11. package/build/comms/hostSlot.d.ts +23 -0
  12. package/build/comms/hostSlot.d.ts.map +1 -0
  13. package/build/comms/hostSlot.js +55 -0
  14. package/build/comms/transport.d.ts +18 -2
  15. package/build/comms/transport.d.ts.map +1 -1
  16. package/build/comms/transport.js +25 -10
  17. package/build/index.d.ts +1 -1
  18. package/build/index.d.ts.map +1 -1
  19. package/build/service-runtime.d.ts +2 -2
  20. package/build/service-runtime.d.ts.map +1 -1
  21. package/build/service-runtime.js +2 -2
  22. package/build/service-types-app.d.ts +1 -1
  23. package/build/service-types-app.d.ts.map +1 -1
  24. package/build/services/AppService/factory/categories.d.ts +30 -0
  25. package/build/services/AppService/factory/categories.d.ts.map +1 -0
  26. package/build/services/AppService/factory/categories.js +11 -0
  27. package/build/services/AppService/factory/resourceAccess.d.ts +1 -1
  28. package/build/services/AppService/factory/resourceAccess.d.ts.map +1 -1
  29. package/build/services/AppService/factory/resourceAccess.js +5 -0
  30. package/build/services/AppService/factory/resourceAssignments.d.ts +66 -0
  31. package/build/services/AppService/factory/resourceAssignments.d.ts.map +1 -0
  32. package/build/services/AppService/factory/resourceAssignments.js +12 -0
  33. package/build/services/AppService/factory/resourceSnapshot.d.ts +13 -0
  34. package/build/services/AppService/factory/resourceSnapshot.d.ts.map +1 -1
  35. package/build/services/AppService/factory/resourceSnapshot.js +21 -0
  36. package/build/services/AppService/factory/resourceUploads.d.ts +37 -0
  37. package/build/services/AppService/factory/resourceUploads.d.ts.map +1 -0
  38. package/build/services/AppService/factory/resourceUploads.js +8 -0
  39. package/build/services/AppService/factory/resources.d.ts +15 -2
  40. package/build/services/AppService/factory/resources.d.ts.map +1 -1
  41. package/build/services/AppService/factory/resources.js +5 -0
  42. package/build/services/AppService/factory/taxonomy.d.ts +25 -0
  43. package/build/services/AppService/factory/taxonomy.d.ts.map +1 -0
  44. package/build/services/AppService/factory/taxonomy.js +5 -0
  45. package/build/services/AppService/index.d.ts +4 -5
  46. package/build/services/AppService/index.d.ts.map +1 -1
  47. package/build/services/AppService/index.js +4 -6
  48. package/build/services/AppService/types/appCategories.d.ts +28 -0
  49. package/build/services/AppService/types/appCategories.d.ts.map +1 -1
  50. package/build/services/AppService/types/resourceAssignments.d.ts +38 -0
  51. package/build/services/AppService/types/resourceAssignments.d.ts.map +1 -0
  52. package/build/services/AppService/types/resourceAssignments.js +10 -0
  53. package/build/services/AppService/types/resourceEntitlements.d.ts +10 -1
  54. package/build/services/AppService/types/resourceEntitlements.d.ts.map +1 -1
  55. package/build/services/AppService/types/resourceReleases.d.ts +13 -6
  56. package/build/services/AppService/types/resourceReleases.d.ts.map +1 -1
  57. package/build/services/AppService/types/sellableResources.d.ts +43 -1
  58. package/build/services/AppService/types/sellableResources.d.ts.map +1 -1
  59. package/build/services/AppService/types/snapshotFileSource.d.ts +110 -0
  60. package/build/services/AppService/types/snapshotFileSource.d.ts.map +1 -0
  61. package/build/services/AppService/types/snapshotFileSource.js +8 -0
  62. package/build/services/AppService/types/snapshotPayload.d.ts +30 -10
  63. package/build/services/AppService/types/snapshotPayload.d.ts.map +1 -1
  64. package/build/services/AppService/types/snapshotPayload.js +5 -2
  65. package/build/services/AppService/types/snapshotSources.d.ts +19 -1
  66. package/build/services/AppService/types/snapshotSources.d.ts.map +1 -1
  67. package/build/services/AppService/types/snapshotUploads.d.ts +109 -0
  68. package/build/services/AppService/types/snapshotUploads.d.ts.map +1 -0
  69. package/build/services/AppService/types/snapshotUploads.js +20 -0
  70. package/build/services/AppService/types/taxonomy.d.ts +76 -0
  71. package/build/services/AppService/types/taxonomy.d.ts.map +1 -0
  72. package/build/services/AppService/types/taxonomy.js +1 -0
  73. package/build/services/AppService/types.d.ts +4 -0
  74. package/build/services/AppService/types.d.ts.map +1 -1
  75. package/build/services/AppService/types.js +4 -0
  76. package/build/services/Webhook/TriggerService.d.ts +44 -0
  77. package/build/services/Webhook/TriggerService.d.ts.map +1 -1
  78. package/build/services/Webhook/TriggerService.js +15 -0
  79. package/package.json +1 -1
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Staging a dataset FILE for a snapshot version (AAD-948).
3
+ *
4
+ * The file-source counterpart of `snapshotSources.ts`, and it answers the same
5
+ * question that one does — what can I publish, and is it within the limits? — for a
6
+ * source the platform has never seen before.
7
+ *
8
+ * Two things about this step are load-bearing:
9
+ *
10
+ * 1. **It is synchronous, and materialisation still is not.** The upload call returns
11
+ * the analysis immediately because the publisher is waiting on it to make their
12
+ * next decision. Creating a version from it is still queued, and `payload_state`
13
+ * still has to be polled. Do not treat a 201 here as publication.
14
+ * 2. **A file that cannot be READ never becomes a version.** It is analysed before
15
+ * anything is stored, so a malformed file is a 422 on `errors.file` with nothing
16
+ * created. That is a different event from a version whose build failed, and the
17
+ * two must not share copy — one is fixed by picking another file, the other by
18
+ * correcting a declaration and retrying.
19
+ */
20
+ /** A dataset file format the store can read. `.jsonl` is accepted and reported as `ndjson`. */
21
+ export type SnapshotUploadFormat = 'csv' | 'json' | 'ndjson';
22
+ /**
23
+ * What the server made of one column of the uploaded file.
24
+ *
25
+ * `proposed_type` is a PROPOSAL, not a schema. The publisher confirms or overrides it
26
+ * per column and their answer is what the version stores — which is what keeps "the
27
+ * schema is declared, not inferred" true for a file source.
28
+ *
29
+ * Every ambiguity resolves to `text` on purpose. A column proposed as text that could
30
+ * have been an integer costs one click; a column proposed as an INTEGER that should
31
+ * have been text turns `01223` into `1223` and silently corrupts a postcode in a
32
+ * dataset somebody paid for.
33
+ */
34
+ export interface SnapshotUploadColumnProposal {
35
+ /** The header exactly as it appears in the file. */
36
+ source_key: string;
37
+ /** A suggested buyer-facing key, derived from the header. The publisher may change it. */
38
+ key: string;
39
+ label: string;
40
+ proposed_type: string;
41
+ /** How many rows were empty here — so the publisher can see WHY a column fell back to text. */
42
+ null_count: number;
43
+ /** Advisory. The authoritative nullability is measured from the finished artifact. */
44
+ nullable: boolean;
45
+ }
46
+ /**
47
+ * A staged file, and everything measured about it.
48
+ *
49
+ * Everything here is measured SERVER-SIDE and none of it is accepted from the client.
50
+ */
51
+ export interface SnapshotUpload {
52
+ id: string;
53
+ resource_id: string;
54
+ original_filename: string;
55
+ format: SnapshotUploadFormat;
56
+ byte_size: number;
57
+ /**
58
+ * The digest of exactly what was uploaded.
59
+ *
60
+ * A file source has no origin anyone can check, so this is the one fact about it
61
+ * that cannot be disputed later. It is also how a publisher who uploaded the wrong
62
+ * export twice tells the two apart when nothing else on the row differs.
63
+ */
64
+ sha256: string;
65
+ row_count: number;
66
+ column_count: number;
67
+ columns: SnapshotUploadColumnProposal[];
68
+ /**
69
+ * Show this BEFORE letting the publisher continue.
70
+ *
71
+ * Above a ceiling the backend refuses the version rather than truncating it, so a
72
+ * publisher who is not warned here hits a wall at the last step of a flow they have
73
+ * already invested in.
74
+ */
75
+ exceeds_limits: {
76
+ rows: boolean;
77
+ bytes: boolean;
78
+ };
79
+ limits: {
80
+ max_rows: number;
81
+ max_bytes: number;
82
+ max_upload_bytes: number;
83
+ };
84
+ /**
85
+ * When an unused upload is swept.
86
+ *
87
+ * An upload nobody turns into a version is pruned, so a publisher who leaves the tab
88
+ * open over a weekend should be told why their file is gone rather than discovering
89
+ * it.
90
+ */
91
+ expires_at: string | null;
92
+ created_at: string | null;
93
+ }
94
+ /**
95
+ * The multipart body for staging a file.
96
+ *
97
+ * Send it through `maybeFormData`, which the SDK already does — it detects the Blob
98
+ * and switches to FormData, and deliberately does not set Content-Type so axios picks
99
+ * the boundary.
100
+ *
101
+ * ⚠️ Check the file's size against `StoreCapabilities.resources_snapshot_max_upload_bytes`
102
+ * first. That is the EFFECTIVE ceiling — the configured one capped by what PHP will
103
+ * accept — and going over it produces a bare 413 that names nothing. A null there
104
+ * means the deployment cannot currently accept uploads at all.
105
+ */
106
+ export interface UploadSnapshotFileData {
107
+ file: File;
108
+ }
109
+ //# sourceMappingURL=snapshotUploads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotUploads.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/types/snapshotUploads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,+FAA+F;AAC/F,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAA;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,4BAA4B;IAC3C,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAA;IAClB,0FAA0F;IAC1F,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,+FAA+F;IAC/F,UAAU,EAAE,MAAM,CAAA;IAClB,sFAAsF;IACtF,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,iBAAiB,EAAE,MAAM,CAAA;IACzB,MAAM,EAAE,oBAAoB,CAAA;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,4BAA4B,EAAE,CAAA;IACvC;;;;;;OAMG;IACH,cAAc,EAAE;QACd,IAAI,EAAE,OAAO,CAAA;QACb,KAAK,EAAE,OAAO,CAAA;KACf,CAAA;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,MAAM,CAAA;QACjB,gBAAgB,EAAE,MAAM,CAAA;KACzB,CAAA;IACD;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,IAAI,CAAA;CACX"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Staging a dataset FILE for a snapshot version (AAD-948).
3
+ *
4
+ * The file-source counterpart of `snapshotSources.ts`, and it answers the same
5
+ * question that one does — what can I publish, and is it within the limits? — for a
6
+ * source the platform has never seen before.
7
+ *
8
+ * Two things about this step are load-bearing:
9
+ *
10
+ * 1. **It is synchronous, and materialisation still is not.** The upload call returns
11
+ * the analysis immediately because the publisher is waiting on it to make their
12
+ * next decision. Creating a version from it is still queued, and `payload_state`
13
+ * still has to be polled. Do not treat a 201 here as publication.
14
+ * 2. **A file that cannot be READ never becomes a version.** It is analysed before
15
+ * anything is stored, so a malformed file is a 422 on `errors.file` with nothing
16
+ * created. That is a different event from a version whose build failed, and the
17
+ * two must not share copy — one is fixed by picking another file, the other by
18
+ * correcting a declaration and retrying.
19
+ */
20
+ export {};
@@ -0,0 +1,76 @@
1
+ import type { ResourceCategory } from './sellableResources';
2
+ /**
3
+ * A top-level kind in Discover: `apps`, and — only when the resource feature
4
+ * flag is on — `services` (AAD-935 item 1).
5
+ *
6
+ * With the flag off the taxonomy carries exactly one kind, which renders as the
7
+ * flat category rail the store has always had. A client must therefore never
8
+ * assume `services` is present.
9
+ */
10
+ export type StoreKindSlug = 'apps' | 'services';
11
+ /**
12
+ * Which listing endpoint a kind is browsed through.
13
+ *
14
+ * Served rather than inferred from the slug: Discover is still a client-side
15
+ * merge of `/store/apps` and `/store/resources`, and hardcoding the mapping is
16
+ * what breaks the day a third kind appears.
17
+ */
18
+ export type StoreKindSource = 'apps' | 'resources';
19
+ /**
20
+ * One entry beneath a kind.
21
+ *
22
+ * **The shape is identical across kinds**, which is the point of
23
+ * `StoreKind.filter_param`: send `?{filter_param}={slug}` without branching on
24
+ * which kind you are in.
25
+ *
26
+ * `slug` has different provenance per kind — the `app_categories` UUID for apps,
27
+ * the `ResourceCategory` enum value for services — but the same position in the
28
+ * request. Do not parse it; pass it through.
29
+ */
30
+ export interface StoreSubcategory {
31
+ /** Pass verbatim as the kind's `filter_param`. A UUID for apps, a `ResourceCategory` for services. */
32
+ slug: string | ResourceCategory;
33
+ name: string;
34
+ /**
35
+ * Apps visible to the requesting license in this category, mirroring the
36
+ * badge on `/store/app-categories`. `null` on a service subcategory, which
37
+ * has no row to count.
38
+ */
39
+ app_count: number | null;
40
+ /**
41
+ * Whether a publisher may pick this category on their own listing.
42
+ *
43
+ * `false` for curated buckets like "System" (AAD-935 item 2): browsable by
44
+ * buyers, never offered in the listing editor. `null` on a service
45
+ * subcategory, which is not assignable at all — resources carry their
46
+ * category as a column, not a pivot.
47
+ */
48
+ is_assignable: boolean | null;
49
+ }
50
+ /**
51
+ * A top-level kind and everything beneath it.
52
+ */
53
+ export interface StoreKind {
54
+ slug: StoreKindSlug;
55
+ /** Display label. "Apps" / "Services". */
56
+ name: string;
57
+ source: StoreKindSource;
58
+ /**
59
+ * The query parameter this kind's `source` endpoint filters on:
60
+ * `category_id` for apps (an array param — `category_id[]=`), `category` for
61
+ * services (a scalar).
62
+ */
63
+ filter_param: 'category_id' | 'category';
64
+ subcategories: StoreSubcategory[];
65
+ }
66
+ /**
67
+ * The Discover navigation tree, from `GET /store/taxonomy`.
68
+ *
69
+ * Navigation only — it does not change either listing endpoint. Both remain
70
+ * unpaginated `{ data: [...] }`, and the client still stamps `kind` itself when
71
+ * it merges the two into one grid.
72
+ */
73
+ export interface StoreTaxonomy {
74
+ kinds: StoreKind[];
75
+ }
76
+ //# sourceMappingURL=taxonomy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taxonomy.d.ts","sourceRoot":"","sources":["../../../../src/services/AppService/types/taxonomy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,UAAU,CAAA;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,WAAW,CAAA;AAElD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sGAAsG;IACtG,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB;;;;;;;OAOG;IACH,aAAa,EAAE,OAAO,GAAG,IAAI,CAAA;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,aAAa,CAAA;IACnB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,eAAe,CAAA;IACvB;;;;OAIG;IACH,YAAY,EAAE,aAAa,GAAG,UAAU,CAAA;IACxC,aAAa,EAAE,gBAAgB,EAAE,CAAA;CAClC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,EAAE,CAAA;CACnB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -12,12 +12,16 @@ export * from './types/channels';
12
12
  export * from './types/pricingTiers';
13
13
  export * from './types/publisherStats';
14
14
  export * from './types/releaseChannels';
15
+ export * from './types/resourceAssignments';
15
16
  export * from './types/resourceEntitlements';
16
17
  export * from './types/resourceReleases';
17
18
  export * from './types/resourceRequests';
18
19
  export * from './types/seats';
19
20
  export * from './types/sellableResources';
21
+ export * from './types/snapshotFileSource';
20
22
  export * from './types/snapshotPayload';
21
23
  export * from './types/snapshotSources';
24
+ export * from './types/snapshotUploads';
22
25
  export * from './types/subscriptions';
26
+ export * from './types/taxonomy';
23
27
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/AppService/types.ts"],"names":[],"mappings":"AAIA,cAAc,wBAAwB,CAAA;AACtC,cAAc,aAAa,CAAA;AAC3B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,eAAe,CAAA;AAC7B,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/AppService/types.ts"],"names":[],"mappings":"AAIA,cAAc,wBAAwB,CAAA;AACtC,cAAc,aAAa,CAAA;AAC3B,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,eAAe,CAAA;AAC7B,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA"}
@@ -15,11 +15,15 @@ export * from './types/channels';
15
15
  export * from './types/pricingTiers';
16
16
  export * from './types/publisherStats';
17
17
  export * from './types/releaseChannels';
18
+ export * from './types/resourceAssignments';
18
19
  export * from './types/resourceEntitlements';
19
20
  export * from './types/resourceReleases';
20
21
  export * from './types/resourceRequests';
21
22
  export * from './types/seats';
22
23
  export * from './types/sellableResources';
24
+ export * from './types/snapshotFileSource';
23
25
  export * from './types/snapshotPayload';
24
26
  export * from './types/snapshotSources';
27
+ export * from './types/snapshotUploads';
25
28
  export * from './types/subscriptions';
29
+ export * from './types/taxonomy';
@@ -1,4 +1,5 @@
1
1
  import type { DataWrapper, PaginatedResponse } from '../../types';
2
+ import type { ResourceAccessReason } from '../AppService/types/resourceEntitlements';
2
3
  import type { LabelFilterParams } from '../LabelService';
3
4
  import type { AuthType, HTTPMethod } from './ConfigService';
4
5
  import type { Event } from './EventService';
@@ -101,14 +102,57 @@ export interface AuthorizationRequiredResult {
101
102
  authorize_url: string;
102
103
  secret_id: string;
103
104
  }
105
+ /**
106
+ * A trigger that consumes a purchased store resource was refused (AAD-940).
107
+ *
108
+ * ⚠️ This arrives as a NON-2xx response, so it surfaces as a rejected request —
109
+ * read it off the error body, not the resolved value. It is wrapped in the
110
+ * dispatch envelope: `error.response.data.response`.
111
+ *
112
+ * **Branch on `reason`, never on the HTTP status** — several reasons share 403.
113
+ * `reason` is a {@link ResourceAccessReason} (`not_entitled`,
114
+ * `entitlement_revoked`, `subscription_expired`, `version_withdrawn`, …) or one
115
+ * of the trigger-side reasons below, which describe the trigger's own
116
+ * configuration rather than the licence's entitlement:
117
+ *
118
+ * | reason | status | what it means |
119
+ * | --- | --- | --- |
120
+ * | `resource_not_configured` | 422 | the trigger names no resource — send the user to edit it |
121
+ * | `resource_not_found` | 404 | the configured listing is gone |
122
+ * | `no_license_context` | 409 | the trigger resolves to no owning licence |
123
+ * | `store_resources_disabled` | 404 | the resource surface is off for this deployment |
124
+ *
125
+ * ⚠️ **Never render this as an empty result.** "Not entitled" and "this dataset
126
+ * has no rows" look identical to a user and call for opposite actions, which is
127
+ * exactly why the refusal is a populated body rather than an empty one.
128
+ */
129
+ export interface ResourceAccessDeniedResult {
130
+ resource_access_denied: true;
131
+ reason: ResourceAccessReason | TriggerResourceReason;
132
+ message: string;
133
+ /** The status the response carried. Informational — branch on `reason`. */
134
+ status_code: number;
135
+ }
136
+ /** Refusals that are about the trigger's configuration, not the entitlement. */
137
+ export type TriggerResourceReason = 'resource_not_configured' | 'resource_not_found' | 'no_license_context' | 'store_resources_disabled';
104
138
  /**
105
139
  * A dispatch returns either the trigger's own response payload or, for an
106
140
  * unconsented per-user OAuth2 binding, an {@link AuthorizationRequiredResult}.
107
141
  * Narrow with {@link isAuthorizationRequired}.
142
+ *
143
+ * A refused resource-consuming trigger does NOT appear here — it is a non-2xx
144
+ * response; see {@link ResourceAccessDeniedResult}.
108
145
  */
109
146
  export type TriggerDispatchResult = AuthorizationRequiredResult | unknown;
110
147
  /** Type guard: is this dispatch result the "user must authorize" envelope? */
111
148
  export declare function isAuthorizationRequired(result: unknown): result is AuthorizationRequiredResult;
149
+ /**
150
+ * Type guard: is this a refused resource-consuming dispatch?
151
+ *
152
+ * Accepts either the dispatch envelope or the inner body, so it can be pointed
153
+ * straight at `error.response?.data` without unwrapping first.
154
+ */
155
+ export declare function isResourceAccessDenied(result: unknown): result is ResourceAccessDeniedResult;
112
156
  export interface TriggerService {
113
157
  fetchTriggers: (triggerableType: TriggerableType, triggerableId: string, params?: TriggerSearchParams) => Promise<PaginatedResponse<Trigger>>;
114
158
  createTrigger: (triggerableType: TriggerableType, triggerableId: string, data: TriggerRequestBody) => Promise<DataWrapper<Trigger>>;
@@ -1 +1 @@
1
- {"version":3,"file":"TriggerService.d.ts","sourceRoot":"","sources":["../../../src/services/Webhook/TriggerService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAA;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,4BAAuB;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,wBAA+B;AAE5D,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,CAAA;AAErD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,EAAE,MAAM,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,UAAU,GAAG,IAAI,CAAA;IAC9B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,SAAS,EAAE,QAAQ,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,GAAG,CAAA;IACZ,YAAY,C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AAE,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,mBAAmB,KAAK,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAA;IAC7I,aAAa,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IACnI,YAAY,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3H,aAAa,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IACtJ,aAAa,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5H,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,6BAA6B,CAAC,CAAA;IAG1E,QAAQ,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;CACzJ;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,aAAa,GAAG,cAAc,CAuB9E"}
@@ -7,6 +7,21 @@ export function isAuthorizationRequired(result) {
7
7
  && typeof record.authorize_url === 'string'
8
8
  && typeof record.secret_id === 'string';
9
9
  }
10
+ /**
11
+ * Type guard: is this a refused resource-consuming dispatch?
12
+ *
13
+ * Accepts either the dispatch envelope or the inner body, so it can be pointed
14
+ * straight at `error.response?.data` without unwrapping first.
15
+ */
16
+ export function isResourceAccessDenied(result) {
17
+ if (typeof result !== 'object' || result === null)
18
+ return false;
19
+ const envelope = result;
20
+ const body = (typeof envelope.response === 'object' && envelope.response !== null)
21
+ ? envelope.response
22
+ : envelope;
23
+ return body.resource_access_denied === true && typeof body.reason === 'string';
24
+ }
10
25
  export function createTriggerService(httpClient) {
11
26
  return {
12
27
  fetchTriggers: (triggerableType, triggerableId, params) => httpClient.get(`/webhook/${triggerableType}/${triggerableId}/triggers`, { params }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antcde/connect-ts",
3
- "version": "0.4.27-rc.3",
3
+ "version": "0.4.27-rc.4",
4
4
  "description": "Helper to connect to the ANT api",
5
5
  "type": "module",
6
6
  "main": "build/index.js",