naystack 1.1.6 → 1.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.
@@ -136,8 +136,11 @@ var setupInstagramWebhook = (options) => {
136
136
  POST: async (req) => {
137
137
  const payload = await req.json();
138
138
  for (const entry of payload.entry) {
139
- for (const change of entry.changes) {
140
- await options.callback(change.field, change.value);
139
+ for (const type of Object.keys(entry)) {
140
+ if (!(entry[type] instanceof Array)) continue;
141
+ for (const change of entry[type]) {
142
+ await options.callback(type, change, entry.id);
143
+ }
141
144
  }
142
145
  }
143
146
  return new Response("OK");
@@ -99,7 +99,7 @@ declare const sendInstagramMessage: (token: string, to: string, text: string) =>
99
99
 
100
100
  declare const setupInstagramWebhook: (options: {
101
101
  secret: string;
102
- callback: (type: string, value: Record<string, any>) => Promise<void>;
102
+ callback: (type: string, value: any, id: string) => Promise<void>;
103
103
  }) => {
104
104
  GET: (req: NextRequest) => next_server.NextResponse<unknown> | undefined;
105
105
  POST: (req: NextRequest) => Promise<Response>;
@@ -99,7 +99,7 @@ declare const sendInstagramMessage: (token: string, to: string, text: string) =>
99
99
 
100
100
  declare const setupInstagramWebhook: (options: {
101
101
  secret: string;
102
- callback: (type: string, value: Record<string, any>) => Promise<void>;
102
+ callback: (type: string, value: any, id: string) => Promise<void>;
103
103
  }) => {
104
104
  GET: (req: NextRequest) => next_server.NextResponse<unknown> | undefined;
105
105
  POST: (req: NextRequest) => Promise<Response>;
@@ -98,8 +98,11 @@ var setupInstagramWebhook = (options) => {
98
98
  POST: async (req) => {
99
99
  const payload = await req.json();
100
100
  for (const entry of payload.entry) {
101
- for (const change of entry.changes) {
102
- await options.callback(change.field, change.value);
101
+ for (const type of Object.keys(entry)) {
102
+ if (!(entry[type] instanceof Array)) continue;
103
+ for (const change of entry[type]) {
104
+ await options.callback(type, change, entry.id);
105
+ }
103
106
  }
104
107
  }
105
108
  return new Response("OK");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "A stack built with tight Next + Drizzle + GraphQL",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",