@conseqa/connector-shopify 0.0.0-reserved.0 → 0.1.8

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.
@@ -0,0 +1,88 @@
1
+ import { z } from "zod";
2
+ /** Shopify names an order by a global ID; the numeric ID from the admin URL is accepted too. */
3
+ export declare function toShopifyOrderGid(value: string): string;
4
+ /**
5
+ * The refund an agent means to make. Amounts follow the Conseqa convention of
6
+ * whole minor units (paise, cents) and upper-case ISO currency codes; Shopify
7
+ * reports decimal strings and is converted at the comparison boundary.
8
+ */
9
+ export declare const shopifyRefundIntentSchema: z.ZodObject<{
10
+ orderId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
11
+ amountMinor: z.ZodNumber;
12
+ currency: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
13
+ }, z.core.$strict>;
14
+ export type ShopifyRefundIntent = z.infer<typeof shopifyRefundIntentSchema>;
15
+ export declare const shopifyRefundBindingSchema: z.ZodObject<{
16
+ refundId: z.ZodString;
17
+ recovered: z.ZodDefault<z.ZodBoolean>;
18
+ }, z.core.$strict>;
19
+ export type ShopifyRefundBinding = z.infer<typeof shopifyRefundBindingSchema>;
20
+ /** What the connector saw, reduced to the facts the verdict rests on. */
21
+ export declare const shopifyRefundObservationSchema: z.ZodObject<{
22
+ refundId: z.ZodString;
23
+ orderId: z.ZodNullable<z.ZodString>;
24
+ correlationKey: z.ZodNullable<z.ZodString>;
25
+ amountMinor: z.ZodNumber;
26
+ currency: z.ZodNullable<z.ZodString>;
27
+ transactionStatuses: z.ZodArray<z.ZodString>;
28
+ status: z.ZodEnum<{
29
+ succeeded: "succeeded";
30
+ pending: "pending";
31
+ failed: "failed";
32
+ no_transactions: "no_transactions";
33
+ }>;
34
+ settled: z.ZodBoolean;
35
+ createdAt: z.ZodNullable<z.ZodString>;
36
+ }, z.core.$strict>;
37
+ export type ShopifyRefundObservation = z.infer<typeof shopifyRefundObservationSchema>;
38
+ export interface ShopifyMoney {
39
+ readonly amount: string;
40
+ readonly currencyCode: string;
41
+ }
42
+ export interface ShopifyMoneyBag {
43
+ readonly shopMoney: ShopifyMoney;
44
+ readonly presentmentMoney?: ShopifyMoney | null;
45
+ }
46
+ export interface ShopifyRefundTransaction {
47
+ readonly id: string;
48
+ readonly kind: string;
49
+ /** SUCCESS, PENDING, FAILURE, ERROR, AWAITING_RESPONSE or UNKNOWN. */
50
+ readonly status: string;
51
+ readonly amountSet: ShopifyMoneyBag;
52
+ }
53
+ export interface ShopifyRefundResource {
54
+ readonly id: string;
55
+ readonly createdAt?: string | null;
56
+ readonly note?: string | null;
57
+ /** Present when the refund was read on its own rather than through its order. */
58
+ readonly orderId?: string;
59
+ readonly transactions: readonly ShopifyRefundTransaction[];
60
+ /** False when the refund has more transactions than one read returns. */
61
+ readonly transactionsComplete: boolean;
62
+ }
63
+ export interface ShopifyOrderRefunds {
64
+ readonly orderId: string;
65
+ readonly refunds: readonly ShopifyRefundResource[];
66
+ /** False when the order has more refunds than one read returns. */
67
+ readonly refundsComplete: boolean;
68
+ }
69
+ /** Everything the connector may ask Shopify. There is no method that writes. */
70
+ export interface ShopifyReadApi {
71
+ /** The order's refunds, or null when the order cannot be read with this token. */
72
+ getOrderRefunds(orderId: string, signal?: AbortSignal): Promise<ShopifyOrderRefunds | null>;
73
+ /** One refund, or null when it does not exist or cannot be read. */
74
+ getRefund(refundId: string, signal?: AbortSignal): Promise<ShopifyRefundResource | null>;
75
+ }
76
+ export type ShopifyRefundDiscoveryResult = {
77
+ readonly kind: "found";
78
+ readonly binding: ShopifyRefundBinding;
79
+ } | {
80
+ readonly kind: "not_found";
81
+ } | {
82
+ readonly kind: "inconclusive";
83
+ readonly reason: "multiple_candidates" | "order_unreadable" | "too_many_refunds" | "schema" | "authentication" | "provider";
84
+ readonly message: string;
85
+ readonly candidateCount?: number;
86
+ readonly retryable?: boolean;
87
+ };
88
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+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;CAC9B,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,51 @@
1
+ import { z } from "zod";
2
+ const ORDER_GID = "gid://shopify/Order/";
3
+ /** Shopify names an order by a global ID; the numeric ID from the admin URL is accepted too. */
4
+ export function toShopifyOrderGid(value) {
5
+ return value.startsWith(ORDER_GID) ? value : `${ORDER_GID}${value}`;
6
+ }
7
+ /**
8
+ * The refund an agent means to make. Amounts follow the Conseqa convention of
9
+ * whole minor units (paise, cents) and upper-case ISO currency codes; Shopify
10
+ * reports decimal strings and is converted at the comparison boundary.
11
+ */
12
+ export const shopifyRefundIntentSchema = z
13
+ .object({
14
+ orderId: z
15
+ .string()
16
+ .regex(/^(?:gid:\/\/shopify\/Order\/)?\d{1,20}$/u)
17
+ .transform(toShopifyOrderGid),
18
+ amountMinor: z.number().int().positive(),
19
+ currency: z
20
+ .string()
21
+ .length(3)
22
+ .transform((value) => value.toUpperCase()),
23
+ })
24
+ .strict();
25
+ export const shopifyRefundBindingSchema = z
26
+ .object({
27
+ refundId: z.string().regex(/^gid:\/\/shopify\/Refund\/\d{1,20}$/u),
28
+ recovered: z.boolean().default(false),
29
+ })
30
+ .strict();
31
+ /** What the connector saw, reduced to the facts the verdict rests on. */
32
+ export const shopifyRefundObservationSchema = z
33
+ .object({
34
+ refundId: z.string(),
35
+ orderId: z.string().nullable(),
36
+ correlationKey: z.string().nullable(),
37
+ /** The sum of the refund's REFUND transactions in the intended currency. */
38
+ amountMinor: z.number().int(),
39
+ currency: z.string().nullable(),
40
+ transactionStatuses: z.array(z.string()),
41
+ status: z.enum(["succeeded", "pending", "failed", "no_transactions"]),
42
+ /**
43
+ * True once Shopify will not change its answer: every refund transaction
44
+ * succeeded, or one failed. A contract file can then call a settled refund
45
+ * that is not exactly right a failure instead of waiting for its deadline.
46
+ */
47
+ settled: z.boolean(),
48
+ createdAt: z.string().nullable(),
49
+ })
50
+ .strict();
51
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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AAM,EAAE,CAAC,QAAQ,EAAE;IACrC,4EAA4E;IAC5E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IACrE;;;;OAIG;IACH,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC;KACD,MAAM,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,44 @@
1
1
  {
2
2
  "name": "@conseqa/connector-shopify",
3
- "version": "0.0.0-reserved.0",
4
- "description": "Reserved for @conseqa/connector-shopify. Install a released version: npm install @conseqa/connector-shopify@latest",
3
+ "version": "0.1.8",
4
+ "description": "Typed, read-only Shopify refund outcome connector for Conseqa",
5
+ "type": "module",
5
6
  "license": "Apache-2.0",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "!dist/**/*.test.*"
16
+ ],
17
+ "dependencies": {
18
+ "zod": "^4.0.17",
19
+ "@conseqa/contracts": "0.1.8",
20
+ "@conseqa/verifiers": "0.1.8"
21
+ },
6
22
  "repository": {
7
23
  "type": "git",
8
- "url": "git+https://github.com/Devrajsinh-Jhala/Conseqa.git"
24
+ "url": "https://github.com/Devrajsinh-Jhala/Conseqa.git",
25
+ "directory": "packages/connector-shopify"
9
26
  },
10
- "files": [
11
- "README.md"
12
- ]
13
- }
27
+ "homepage": "https://github.com/Devrajsinh-Jhala/Conseqa#readme",
28
+ "bugs": {
29
+ "url": "https://github.com/Devrajsinh-Jhala/Conseqa/issues"
30
+ },
31
+ "engines": {
32
+ "node": ">=22.13.0"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "scripts": {
38
+ "build": "tsc -p tsconfig.json",
39
+ "check": "pnpm typecheck && pnpm test",
40
+ "test": "vitest run",
41
+ "test:coverage": "vitest run --coverage",
42
+ "typecheck": "tsc -p tsconfig.json --noEmit"
43
+ }
44
+ }
package/README.md DELETED
@@ -1,7 +0,0 @@
1
- # @conseqa/connector-shopify
2
-
3
- This version only reserves the name. Install a released version:
4
-
5
- npm install @conseqa/connector-shopify@latest
6
-
7
- See https://github.com/Devrajsinh-Jhala/Conseqa.