@useairfoil/producer-shopify 0.2.0 → 0.2.2

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 (61) hide show
  1. package/LICENSE.txt +201 -0
  2. package/README.md +85 -248
  3. package/dist/index.d.mts +6993 -0
  4. package/dist/index.mjs +3 -0
  5. package/dist/main.d.mts +1 -0
  6. package/dist/main.mjs +700 -0
  7. package/dist/main.mjs.map +1 -0
  8. package/dist/manifest.d.mts +32 -0
  9. package/dist/manifest.mjs +51 -0
  10. package/dist/manifest.mjs.map +1 -0
  11. package/dist/{chunk-Bp6m_JJh.js → rolldown-runtime-D7D4PA-g.mjs} +4 -4
  12. package/dist/src-YBU_KSf5.mjs +2472 -0
  13. package/dist/src-YBU_KSf5.mjs.map +1 -0
  14. package/package.json +27 -27
  15. package/src/{auth.ts → api/auth.ts} +15 -35
  16. package/src/api/client.ts +429 -0
  17. package/src/api/graphql.ts +221 -0
  18. package/src/api/http.ts +25 -0
  19. package/src/connector.ts +266 -163
  20. package/src/create-table.ts +10 -0
  21. package/src/demo/customers.ts +412 -0
  22. package/src/demo/index.ts +31 -0
  23. package/src/demo/setup.ts +63 -0
  24. package/src/demo/shared.ts +114 -0
  25. package/src/index.ts +35 -21
  26. package/src/main.ts +14 -8
  27. package/src/manifest.ts +4 -55
  28. package/src/resources/carts/row.ts +82 -0
  29. package/src/resources/carts/webhook.ts +98 -0
  30. package/src/resources/customers/graphql.ts +175 -0
  31. package/src/resources/customers/row.ts +140 -0
  32. package/src/resources/customers/webhook.ts +30 -0
  33. package/src/resources/orders/graphql.ts +419 -0
  34. package/src/resources/orders/row.ts +306 -0
  35. package/src/resources/orders/webhook.ts +248 -0
  36. package/src/resources/products/graphql.ts +142 -0
  37. package/src/resources/products/row.ts +122 -0
  38. package/src/resources/products/webhook.ts +130 -0
  39. package/src/resources/refunds/graphql.ts +196 -0
  40. package/src/resources/refunds/row.ts +137 -0
  41. package/src/resources/refunds/webhook.ts +123 -0
  42. package/src/resources/shared.ts +300 -0
  43. package/src/sandbox.ts +3 -3
  44. package/src/start.ts +4 -6
  45. package/src/tables.ts +15 -0
  46. package/dist/index.d.ts +0 -965
  47. package/dist/index.js +0 -4
  48. package/dist/main.d.ts +0 -1
  49. package/dist/main.js +0 -49
  50. package/dist/main.js.map +0 -1
  51. package/dist/manifest-BFfx2LkS.js +0 -91
  52. package/dist/manifest-BFfx2LkS.js.map +0 -1
  53. package/dist/manifest-CPOEExQU.d.ts +0 -34
  54. package/dist/manifest.d.ts +0 -2
  55. package/dist/manifest.js +0 -3
  56. package/dist/src-DqmiLrYS.js +0 -984
  57. package/dist/src-DqmiLrYS.js.map +0 -1
  58. package/src/api.ts +0 -636
  59. package/src/schemas.ts +0 -319
  60. package/src/throttle.ts +0 -89
  61. package/src/transient-retry.ts +0 -74
@@ -0,0 +1,123 @@
1
+ import * as Schema from "effect/Schema";
2
+
3
+ import { RestMoneyBagSchema, fromRest, gid, normalizeAmount, upper } from "../shared";
4
+ import {
5
+ type Refund,
6
+ RestockTypeSchema,
7
+ TransactionKindSchema,
8
+ TransactionStatusSchema,
9
+ } from "./row";
10
+
11
+ export const RefundWebhookPayloadSchema = Schema.Struct({
12
+ id: Schema.Number,
13
+ admin_graphql_api_id: Schema.String,
14
+ order_id: Schema.Number,
15
+ note: Schema.NullOr(Schema.String),
16
+ created_at: Schema.NullOr(Schema.DateFromString),
17
+ processed_at: Schema.DateFromString,
18
+ transactions: Schema.Array(
19
+ Schema.Struct({
20
+ admin_graphql_api_id: Schema.String,
21
+ kind: upper(TransactionKindSchema),
22
+ status: upper(TransactionStatusSchema),
23
+ amount: Schema.String,
24
+ currency: Schema.String,
25
+ gateway: Schema.NullOr(Schema.String),
26
+ test: Schema.Boolean,
27
+ error_code: Schema.NullOr(Schema.String),
28
+ parent_id: Schema.NullOr(Schema.Number),
29
+ created_at: Schema.DateFromString,
30
+ processed_at: Schema.NullOr(Schema.DateFromString),
31
+ }),
32
+ ),
33
+ refund_line_items: Schema.Array(
34
+ Schema.Struct({
35
+ id: Schema.Number,
36
+ line_item_id: Schema.Number,
37
+ quantity: Schema.Int,
38
+ restock_type: upper(RestockTypeSchema),
39
+ location_id: Schema.NullOr(Schema.Number),
40
+ subtotal_set: RestMoneyBagSchema,
41
+ total_tax_set: RestMoneyBagSchema,
42
+ }),
43
+ ),
44
+ refund_shipping_lines: Schema.Array(
45
+ Schema.Struct({
46
+ id: Schema.Number,
47
+ shipping_line_id: Schema.NullOr(Schema.Number),
48
+ subtotal_amount_set: RestMoneyBagSchema,
49
+ }),
50
+ ),
51
+ order_adjustments: Schema.Array(
52
+ Schema.Struct({
53
+ id: Schema.Number,
54
+ kind: Schema.NullOr(Schema.String),
55
+ reason: Schema.NullOr(Schema.String),
56
+ amount_set: RestMoneyBagSchema,
57
+ tax_amount_set: RestMoneyBagSchema,
58
+ }),
59
+ ),
60
+ duties: Schema.Array(
61
+ Schema.Struct({
62
+ duty_id: Schema.NullOr(Schema.Number),
63
+ amount_set: RestMoneyBagSchema,
64
+ }),
65
+ ),
66
+ });
67
+
68
+ export const RefundEventSchema = Schema.toType(RefundWebhookPayloadSchema);
69
+
70
+ export type RefundWebhookPayload = Schema.Schema.Type<typeof RefundWebhookPayloadSchema>;
71
+
72
+ export const fromRefundWebhook = (payload: RefundWebhookPayload): Refund => ({
73
+ id: payload.admin_graphql_api_id,
74
+ legacyResourceId: String(payload.id),
75
+ orderId: gid("Order", payload.order_id),
76
+ note: payload.note ?? "",
77
+ createdAt: payload.created_at,
78
+ processedAt: payload.processed_at,
79
+ // Webhooks only give transaction amounts in the customer currency.
80
+ transactions: payload.transactions.map((transaction) => ({
81
+ id: transaction.admin_graphql_api_id,
82
+ kind: transaction.kind,
83
+ status: transaction.status,
84
+ amount: normalizeAmount(transaction.amount),
85
+ currencyCode: transaction.currency,
86
+ gateway: transaction.gateway,
87
+ test: transaction.test,
88
+ errorCode: transaction.error_code?.toUpperCase() ?? null,
89
+ parentTransactionId:
90
+ transaction.parent_id === null ? null : gid("OrderTransaction", transaction.parent_id),
91
+ createdAt: transaction.created_at,
92
+ processedAt: transaction.processed_at,
93
+ })),
94
+ refundLineItems: payload.refund_line_items.map((item) => ({
95
+ id: gid("RefundLineItem", item.id),
96
+ lineItemId: gid("LineItem", item.line_item_id),
97
+ quantity: item.quantity,
98
+ restockType: item.restock_type,
99
+ locationId: item.location_id === null ? null : gid("Location", item.location_id),
100
+ subtotalSet: fromRest.money(item.subtotal_set),
101
+ totalTaxSet: fromRest.money(item.total_tax_set),
102
+ })),
103
+ refundShippingLines: payload.refund_shipping_lines.map((line) => ({
104
+ id: gid("RefundShippingLine", line.id),
105
+ shippingLineId:
106
+ line.shipping_line_id === null ? null : gid("ShippingLine", line.shipping_line_id),
107
+ subtotalAmountSet: fromRest.money(line.subtotal_amount_set),
108
+ })),
109
+ // Webhooks also list refunded shipping as an adjustment. GraphQL doesn't.
110
+ orderAdjustments: payload.order_adjustments
111
+ .filter((adjustment) => adjustment.kind !== "shipping_refund")
112
+ .map((adjustment) => ({
113
+ id: gid("OrderAdjustment", adjustment.id),
114
+ // Webhooks send text like "Refund discrepancy". GraphQL sends REFUND_DISCREPANCY.
115
+ reason: adjustment.reason?.toUpperCase().replaceAll(" ", "_") ?? null,
116
+ amountSet: fromRest.money(adjustment.amount_set),
117
+ taxAmountSet: fromRest.money(adjustment.tax_amount_set),
118
+ })),
119
+ duties: payload.duties.map((duty) => ({
120
+ dutyId: duty.duty_id === null ? null : gid("Duty", duty.duty_id),
121
+ amountSet: fromRest.money(duty.amount_set),
122
+ })),
123
+ });
@@ -0,0 +1,300 @@
1
+ import { SchemaTransformation } from "effect";
2
+ import * as Schema from "effect/Schema";
3
+
4
+ export const PageInfoSchema = Schema.Struct({
5
+ hasNextPage: Schema.Boolean,
6
+ endCursor: Schema.NullOr(Schema.String),
7
+ });
8
+
9
+ export const gid = (type: string, id: number | string): string => `gid://shopify/${type}/${id}`;
10
+
11
+ export const normalizeAmount = (amount: string): string =>
12
+ amount.includes(".") ? amount.replace(/0+$/, "").replace(/\.$/, "") : amount;
13
+
14
+ export const emptyText = (value: string | null): string => value ?? "";
15
+
16
+ export const splitTags = (value: string): ReadonlyArray<string> =>
17
+ value
18
+ .split(",")
19
+ .map((tag) => tag.trim())
20
+ .filter((tag) => tag.length > 0);
21
+
22
+ export const moneyBag = Schema.Struct({
23
+ shopMoney: Schema.Struct({
24
+ amount: Schema.String.pipe(Schema.annotateKey({ description: "Amount in the shop currency." })),
25
+ currencyCode: Schema.String.pipe(Schema.annotateKey({ description: "Shop currency code." })),
26
+ }).pipe(Schema.annotateKey({ description: "Amount in the shop currency." })),
27
+ presentmentMoney: Schema.Struct({
28
+ amount: Schema.String.pipe(
29
+ Schema.annotateKey({ description: "Amount in the customer currency." }),
30
+ ),
31
+ currencyCode: Schema.String.pipe(
32
+ Schema.annotateKey({ description: "Customer currency code." }),
33
+ ),
34
+ }).pipe(Schema.annotateKey({ description: "Amount in the customer currency." })),
35
+ });
36
+
37
+ export const address = Schema.Struct({
38
+ firstName: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "First name." })),
39
+ lastName: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "Last name." })),
40
+ name: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "Full name." })),
41
+ company: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "Company name." })),
42
+ address1: Schema.NullOr(Schema.String).pipe(
43
+ Schema.annotateKey({ description: "First address line." }),
44
+ ),
45
+ address2: Schema.NullOr(Schema.String).pipe(
46
+ Schema.annotateKey({ description: "Second address line." }),
47
+ ),
48
+ city: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "City." })),
49
+ province: Schema.NullOr(Schema.String).pipe(
50
+ Schema.annotateKey({ description: "Province or state." }),
51
+ ),
52
+ provinceCode: Schema.NullOr(Schema.String).pipe(
53
+ Schema.annotateKey({ description: "Province or state code." }),
54
+ ),
55
+ country: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "Country." })),
56
+ countryCode: Schema.NullOr(Schema.String).pipe(
57
+ Schema.annotateKey({ description: "Two-letter country code." }),
58
+ ),
59
+ zip: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "Postal code." })),
60
+ phone: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "Phone number." })),
61
+ latitude: Schema.NullOr(Schema.Finite).pipe(Schema.annotateKey({ description: "Latitude." })),
62
+ longitude: Schema.NullOr(Schema.Finite).pipe(Schema.annotateKey({ description: "Longitude." })),
63
+ });
64
+
65
+ export const attributes = Schema.Array(
66
+ Schema.Struct({
67
+ key: Schema.String.pipe(Schema.annotateKey({ description: "Attribute name." })),
68
+ value: Schema.NullOr(Schema.String).pipe(
69
+ Schema.annotateKey({ description: "Attribute value." }),
70
+ ),
71
+ }),
72
+ );
73
+
74
+ export const taxLines = Schema.Array(
75
+ Schema.Struct({
76
+ title: Schema.String.pipe(Schema.annotateKey({ description: "Tax name." })),
77
+ rate: Schema.NullOr(Schema.Finite).pipe(
78
+ Schema.annotateKey({ description: "Tax rate as a fraction." }),
79
+ ),
80
+ priceSet: moneyBag.pipe(Schema.annotateKey({ description: "Tax amount." })),
81
+ }),
82
+ );
83
+
84
+ export const discountAllocations = Schema.Array(
85
+ Schema.Struct({
86
+ discountApplicationIndex: Schema.Int.pipe(
87
+ Schema.annotateKey({ description: "Index of the order discount application." }),
88
+ ),
89
+ amountSet: moneyBag.pipe(Schema.annotateKey({ description: "Allocated discount amount." })),
90
+ }),
91
+ );
92
+
93
+ export type MoneyBag = Schema.Schema.Type<typeof moneyBag>;
94
+
95
+ export type Address = Schema.Schema.Type<typeof address>;
96
+
97
+ export type Attribute = Schema.Schema.Type<typeof attributes>[number];
98
+
99
+ export type TaxLine = Schema.Schema.Type<typeof taxLines>[number];
100
+
101
+ export type DiscountAllocation = Schema.Schema.Type<typeof discountAllocations>[number];
102
+
103
+ export const RestMoneyBagSchema = Schema.Struct({
104
+ shop_money: Schema.Struct({ amount: Schema.String, currency_code: Schema.String }),
105
+ presentment_money: Schema.Struct({ amount: Schema.String, currency_code: Schema.String }),
106
+ });
107
+
108
+ const nullableText = Schema.NullOr(Schema.String);
109
+
110
+ export const RestAddressSchema = Schema.Struct({
111
+ first_name: nullableText,
112
+ last_name: nullableText,
113
+ name: nullableText,
114
+ company: nullableText,
115
+ address1: nullableText,
116
+ address2: nullableText,
117
+ city: nullableText,
118
+ province: nullableText,
119
+ province_code: nullableText,
120
+ country: nullableText,
121
+ country_code: nullableText,
122
+ zip: nullableText,
123
+ phone: nullableText,
124
+ latitude: Schema.NullOr(Schema.Number),
125
+ longitude: Schema.NullOr(Schema.Number),
126
+ });
127
+
128
+ export const RestAttributeSchema = Schema.Struct({
129
+ name: Schema.String,
130
+ value: Schema.NullOr(Schema.String),
131
+ });
132
+
133
+ export const RestTaxLineSchema = Schema.Struct({
134
+ title: Schema.String,
135
+ rate: Schema.NullOr(Schema.Number),
136
+ price_set: RestMoneyBagSchema,
137
+ });
138
+
139
+ export const RestDiscountAllocationSchema = Schema.Struct({
140
+ discount_application_index: Schema.Int,
141
+ amount_set: RestMoneyBagSchema,
142
+ });
143
+
144
+ type RestMoneyBag = Schema.Schema.Type<typeof RestMoneyBagSchema>;
145
+
146
+ type RestAddress = Schema.Schema.Type<typeof RestAddressSchema>;
147
+
148
+ export const fromRest = {
149
+ money: (bag: RestMoneyBag): MoneyBag => ({
150
+ shopMoney: {
151
+ amount: normalizeAmount(bag.shop_money.amount),
152
+ currencyCode: bag.shop_money.currency_code,
153
+ },
154
+ presentmentMoney: {
155
+ amount: normalizeAmount(bag.presentment_money.amount),
156
+ currencyCode: bag.presentment_money.currency_code,
157
+ },
158
+ }),
159
+ address: (value: RestAddress): Address => ({
160
+ firstName: value.first_name,
161
+ lastName: value.last_name,
162
+ name: value.name,
163
+ company: value.company,
164
+ address1: value.address1,
165
+ address2: value.address2,
166
+ city: value.city,
167
+ province: value.province,
168
+ provinceCode: value.province_code,
169
+ country: value.country,
170
+ countryCode: value.country_code,
171
+ zip: value.zip,
172
+ phone: value.phone,
173
+ latitude: value.latitude,
174
+ longitude: value.longitude,
175
+ }),
176
+ attribute: (value: Schema.Schema.Type<typeof RestAttributeSchema>): Attribute => ({
177
+ key: value.name,
178
+ value: value.value,
179
+ }),
180
+ taxLine: (value: Schema.Schema.Type<typeof RestTaxLineSchema>): TaxLine => ({
181
+ title: value.title,
182
+ rate: value.rate,
183
+ priceSet: fromRest.money(value.price_set),
184
+ }),
185
+ discountAllocation: (
186
+ value: Schema.Schema.Type<typeof RestDiscountAllocationSchema>,
187
+ ): DiscountAllocation => ({
188
+ discountApplicationIndex: value.discount_application_index,
189
+ amountSet: fromRest.money(value.amount_set),
190
+ }),
191
+ };
192
+
193
+ export const MoneyBagFields = `shopMoney { amount currencyCode } presentmentMoney { amount currencyCode }`;
194
+
195
+ export const AddressFields = `firstName lastName name company address1 address2 city province provinceCode country countryCodeV2 zip phone latitude longitude`;
196
+
197
+ export const TaxLineFields = `title rate priceSet { ${MoneyBagFields} }`;
198
+
199
+ export const DiscountAllocationFields = `allocatedAmountSet { ${MoneyBagFields} } discountApplication { index }`;
200
+
201
+ export const GraphQLMoneyBagSchema = Schema.Struct({
202
+ shopMoney: Schema.Struct({ amount: Schema.String, currencyCode: Schema.String }),
203
+ presentmentMoney: Schema.Struct({ amount: Schema.String, currencyCode: Schema.String }),
204
+ });
205
+
206
+ export const GraphQLAddressSchema = Schema.Struct({
207
+ firstName: Schema.NullOr(Schema.String),
208
+ lastName: Schema.NullOr(Schema.String),
209
+ name: Schema.NullOr(Schema.String),
210
+ company: Schema.NullOr(Schema.String),
211
+ address1: Schema.NullOr(Schema.String),
212
+ address2: Schema.NullOr(Schema.String),
213
+ city: Schema.NullOr(Schema.String),
214
+ province: Schema.NullOr(Schema.String),
215
+ provinceCode: Schema.NullOr(Schema.String),
216
+ country: Schema.NullOr(Schema.String),
217
+ countryCodeV2: Schema.NullOr(Schema.String),
218
+ zip: Schema.NullOr(Schema.String),
219
+ phone: Schema.NullOr(Schema.String),
220
+ latitude: Schema.NullOr(Schema.Number),
221
+ longitude: Schema.NullOr(Schema.Number),
222
+ });
223
+
224
+ export const GraphQLAttributeSchema = Schema.Struct({
225
+ key: Schema.String,
226
+ value: Schema.NullOr(Schema.String),
227
+ });
228
+
229
+ export const GraphQLTaxLineSchema = Schema.Struct({
230
+ title: Schema.String,
231
+ rate: Schema.NullOr(Schema.Number),
232
+ priceSet: GraphQLMoneyBagSchema,
233
+ });
234
+
235
+ export const GraphQLDiscountAllocationSchema = Schema.Struct({
236
+ allocatedAmountSet: GraphQLMoneyBagSchema,
237
+ discountApplication: Schema.Struct({ index: Schema.Int }),
238
+ });
239
+
240
+ export const connection = <S extends Schema.Top>(node: S) =>
241
+ Schema.Struct({ nodes: Schema.Array(node), pageInfo: PageInfoSchema });
242
+
243
+ type GraphQLMoneyBag = Schema.Schema.Type<typeof GraphQLMoneyBagSchema>;
244
+
245
+ type GraphQLAddress = Schema.Schema.Type<typeof GraphQLAddressSchema>;
246
+
247
+ export const fromGraphQL = {
248
+ money: (bag: GraphQLMoneyBag): MoneyBag => ({
249
+ shopMoney: {
250
+ amount: normalizeAmount(bag.shopMoney.amount),
251
+ currencyCode: bag.shopMoney.currencyCode,
252
+ },
253
+ presentmentMoney: {
254
+ amount: normalizeAmount(bag.presentmentMoney.amount),
255
+ currencyCode: bag.presentmentMoney.currencyCode,
256
+ },
257
+ }),
258
+ address: ({ countryCodeV2, ...value }: GraphQLAddress): Address => ({
259
+ ...value,
260
+ countryCode: countryCodeV2,
261
+ }),
262
+ taxLine: (value: Schema.Schema.Type<typeof GraphQLTaxLineSchema>): TaxLine => ({
263
+ title: value.title,
264
+ rate: value.rate,
265
+ priceSet: fromGraphQL.money(value.priceSet),
266
+ }),
267
+ discountAllocation: (
268
+ value: Schema.Schema.Type<typeof GraphQLDiscountAllocationSchema>,
269
+ ): DiscountAllocation => ({
270
+ discountApplicationIndex: value.discountApplication.index,
271
+ amountSet: fromGraphQL.money(value.allocatedAmountSet),
272
+ }),
273
+ };
274
+
275
+ // Webhooks send enum values in lower case.
276
+ export const upper = <const L extends ReadonlyArray<string>>(literals: Schema.Literals<L>) =>
277
+ Schema.String.pipe(Schema.decode(SchemaTransformation.toUpperCase()), Schema.decodeTo(literals));
278
+
279
+ export const PageInfoFields = `pageInfo { hasNextPage endCursor }`;
280
+
281
+ export const idRef = Schema.NullOr(Schema.Struct({ id: Schema.String }));
282
+
283
+ export type Nodes<S extends Schema.Top> =
284
+ Schema.Schema.Type<S> extends { readonly nodes: infer N } ? N : never;
285
+
286
+ export const pageQuery = (name: string, connection: string, fields: string) => `#graphql
287
+ query ${name}($first: Int!, $after: String) {
288
+ ${connection}(first: $first, after: $after) {
289
+ nodes {
290
+ ${fields}
291
+ }
292
+ pageInfo {
293
+ hasNextPage
294
+ endCursor
295
+ }
296
+ }
297
+ }
298
+ `;
299
+
300
+ export type PageInfo = Schema.Schema.Type<typeof PageInfoSchema>;
package/src/sandbox.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ConnectorApp,
3
- Publisher,
3
+ Ingestor,
4
4
  RuntimeConfig,
5
5
  StateStore,
6
6
  Telemetry,
7
7
  } from "@useairfoil/connector-kit";
8
8
  import { Effect, Layer, Logger } from "effect";
9
- import { Command } from "effect/unstable/cli";
9
+ import { Command } from "effect/cli";
10
10
 
11
11
  import { ShopifyConnector } from "./index";
12
12
 
@@ -28,7 +28,7 @@ export const sandboxCommand = Command.make("sandbox", {}, () =>
28
28
  Effect.provide(
29
29
  Layer.mergeAll(
30
30
  StateStore.layerMemory,
31
- Publisher.layerConsole,
31
+ Ingestor.layerConsole,
32
32
  ConnectorLayer,
33
33
  Logger.layer([Logger.consolePretty()]),
34
34
  TelemetryLayer,
package/src/start.ts CHANGED
@@ -1,14 +1,13 @@
1
1
  import { PgClient } from "@effect/sql-pg";
2
2
  import {
3
3
  ConnectorApp,
4
- Publisher,
4
+ Ingestor,
5
5
  RuntimeConfig,
6
6
  StateStore,
7
7
  Telemetry,
8
8
  } from "@useairfoil/connector-kit";
9
- import { WingsClient } from "@useairfoil/wings";
10
9
  import { Config, Effect, Layer, Logger, Schema } from "effect";
11
- import { Command } from "effect/unstable/cli";
10
+ import { Command } from "effect/cli";
12
11
 
13
12
  import { ShopifyConnector } from "./index";
14
13
 
@@ -34,7 +33,7 @@ export const startCommand = Command.make("start", {}, () =>
34
33
  const entrypoint = yield* ShopifyConnector.ShopifyConnector;
35
34
 
36
35
  return yield* ConnectorApp.start(entrypoint, { port }).pipe(
37
- Effect.provide(Publisher.layerWingsConfig(entrypoint)),
36
+ Effect.provide(Ingestor.layerArrowFlightConfig(entrypoint)),
38
37
  );
39
38
  }).pipe(
40
39
  Effect.annotateLogs({ component: "producer-shopify" }),
@@ -42,11 +41,10 @@ export const startCommand = Command.make("start", {}, () =>
42
41
  Layer.mergeAll(
43
42
  StateStoreLayer,
44
43
  ConnectorLayer,
45
- WingsClient.layerConfig(RuntimeConfig.wingsClient),
46
44
  Logger.layer([Logger.consolePretty()]),
47
45
  TelemetryLayer,
48
46
  ),
49
47
  ),
50
48
  Effect.provide(RuntimeConfig.layerHosted()),
51
49
  ),
52
- ).pipe(Command.withDescription("Run the production connector against Wings"));
50
+ ).pipe(Command.withDescription("Run the connector"));
package/src/tables.ts ADDED
@@ -0,0 +1,15 @@
1
+ import * as Schema from "effect/Schema";
2
+
3
+ import { CartSchema } from "./resources/carts/row";
4
+ import { CustomerSchema } from "./resources/customers/row";
5
+ import { OrderSchema } from "./resources/orders/row";
6
+ import { ProductSchema } from "./resources/products/row";
7
+ import { RefundSchema } from "./resources/refunds/row";
8
+
9
+ export const tableSchemas: Readonly<Record<string, Schema.Top>> = {
10
+ products: ProductSchema,
11
+ carts: CartSchema,
12
+ customers: CustomerSchema,
13
+ orders: OrderSchema,
14
+ refunds: RefundSchema,
15
+ };