@devvit/protos 0.11.0-next-2024-07-11-64bff079e.0 → 0.11.0-next-2024-07-11-c0e47b869.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvit/protos",
3
- "version": "0.11.0-next-2024-07-11-64bff079e.0",
3
+ "version": "0.11.0-next-2024-07-11-c0e47b869.0",
4
4
  "license": "BSD-3-Clause",
5
5
  "repository": {
6
6
  "type": "git",
@@ -44,9 +44,9 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@ampproject/filesize": "4.3.0",
47
- "@devvit/eslint-config": "0.11.0-next-2024-07-11-64bff079e.0",
48
- "@devvit/repo-tools": "0.11.0-next-2024-07-11-64bff079e.0",
49
- "@devvit/tsconfig": "0.11.0-next-2024-07-11-64bff079e.0",
47
+ "@devvit/eslint-config": "0.11.0-next-2024-07-11-c0e47b869.0",
48
+ "@devvit/repo-tools": "0.11.0-next-2024-07-11-c0e47b869.0",
49
+ "@devvit/tsconfig": "0.11.0-next-2024-07-11-c0e47b869.0",
50
50
  "@types/long": "4.0.2",
51
51
  "chokidar-cli": "3.0.0",
52
52
  "esbuild": "0.18.12",
@@ -79,5 +79,5 @@
79
79
  ]
80
80
  }
81
81
  },
82
- "gitHead": "e882b96046466a1b3938b94b0bb3eff1b2e230e7"
82
+ "gitHead": "d34969059bb70bf842f44eaf808ba6452c208fa0"
83
83
  }
@@ -32,6 +32,9 @@ message Order {
32
32
  // Reserved so we are compatible with internal Payment protos
33
33
  reserved 6, 7;
34
34
  reserved "checkout_action", "status_reason";
35
+
36
+ // user-defined metadata about the order
37
+ map<string, string> metadata = 1001;
35
38
  }
36
39
 
37
40
  enum OrderStatus {
@@ -32,6 +32,14 @@ export interface Order {
32
32
  products: Product[];
33
33
  /** whether or not the order was placed in the development sandbox or production */
34
34
  environment: Environment;
35
+ /** user-defined metadata about the order */
36
+ metadata: {
37
+ [key: string]: string;
38
+ };
39
+ }
40
+ export interface Order_MetadataEntry {
41
+ key: string;
42
+ value: string;
35
43
  }
36
44
  export declare const Order: {
37
45
  $type: "devvit.payments.v1alpha.Order";
@@ -42,6 +50,15 @@ export declare const Order: {
42
50
  create(base?: DeepPartial<Order>): Order;
43
51
  fromPartial(object: DeepPartial<Order>): Order;
44
52
  };
53
+ export declare const Order_MetadataEntry: {
54
+ $type: "devvit.payments.v1alpha.Order.MetadataEntry";
55
+ encode(message: Order_MetadataEntry, writer?: _m0.Writer): _m0.Writer;
56
+ decode(input: _m0.Reader | Uint8Array, length?: number): Order_MetadataEntry;
57
+ fromJSON(object: any): Order_MetadataEntry;
58
+ toJSON(message: Order_MetadataEntry): unknown;
59
+ create(base?: DeepPartial<Order_MetadataEntry>): Order_MetadataEntry;
60
+ fromPartial(object: DeepPartial<Order_MetadataEntry>): Order_MetadataEntry;
61
+ };
45
62
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
46
63
  type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
47
64
  [K in keyof T]?: DeepPartial<T[K]>;
@@ -1 +1 @@
1
- {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../../../src/types/devvit/payments/v1alpha/order.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,GAAG,MAAM,uBAAuB,CAAC;AAGxC,OAAO,EAAE,WAAW,EAA0C,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,oBAAY,WAAW;IACrB,wBAAwB,IAAI;IAC5B,gBAAgB,IAAI;IACpB,oBAAoB,IAAI;IACxB,iBAAiB,IAAI;IACrB,sBAAsB,IAAI;IAC1B,qBAAqB,IAAI;IACzB,qBAAqB,IAAI;IACzB,YAAY,KAAK;CAClB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,GAAG,WAAW,CA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,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../../../src/types/devvit/payments/v1alpha/order.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,GAAG,MAAM,uBAAuB,CAAC;AAGxC,OAAO,EAAE,WAAW,EAA0C,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,oBAAY,WAAW;IACrB,wBAAwB,IAAI;IAC5B,gBAAgB,IAAI;IACpB,oBAAoB,IAAI;IACxB,iBAAiB,IAAI;IACrB,sBAAsB,IAAI;IAC1B,qBAAqB,IAAI;IACzB,qBAAqB,IAAI;IACzB,YAAY,KAAK;CAClB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,GAAG,WAAW,CA4B5D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAoB7D;AAED,iDAAiD;AACjD,MAAM,WAAW,KAAK;IACpB,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,0CAA0C;IAC1C,MAAM,EAAE,WAAW,CAAC;IACpB,iCAAiC;IACjC,SAAS,CAAC,EACN,IAAI,GACJ,SAAS,CAAC;IACd,sCAAsC;IACtC,SAAS,CAAC,EACN,IAAI,GACJ,SAAS,CAAC;IACd,qCAAqC;IACrC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,mFAAmF;IACnF,WAAW,EAAE,WAAW,CAAC;IACzB,4CAA4C;IAC5C,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACrC;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAMD,eAAO,MAAM,KAAK;;oBAGA,KAAK,WAAU,IAAI,MAAM,GAAyB,IAAI,MAAM;kBAyB9D,IAAI,MAAM,GAAG,UAAU,WAAW,MAAM,GAAG,KAAK;qBAoE7C,GAAG,GAAG,KAAK;oBAiBZ,KAAK,GAAG,OAAO;kBAgCjB,YAAY,KAAK,CAAC,GAAG,KAAK;wBAGpB,YAAY,KAAK,CAAC,GAAG,KAAK;CAgB/C,CAAC;AAQF,eAAO,MAAM,mBAAmB;;oBAGd,mBAAmB,WAAU,IAAI,MAAM,GAAyB,IAAI,MAAM;kBAU5E,IAAI,MAAM,GAAG,UAAU,WAAW,MAAM,GAAG,mBAAmB;qBA8B3D,GAAG,GAAG,mBAAmB;oBAO1B,mBAAmB,GAAG,OAAO;kBAW/B,YAAY,mBAAmB,CAAC,GAAG,mBAAmB;wBAGhD,YAAY,mBAAmB,CAAC,GAAG,mBAAmB;CAM3E,CAAC;AAIF,KAAK,OAAO,GAAG,IAAI,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEpF,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,CAAC,GACvC,CAAC,SAAS,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACtE,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAChE,CAAC,SAAS,EAAE,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACrD,OAAO,CAAC,CAAC,CAAC,CAAC"}
@@ -71,7 +71,7 @@ export function orderStatusToJSON(object) {
71
71
  }
72
72
  }
73
73
  function createBaseOrder() {
74
- return { id: "", status: 0, createdAt: undefined, updatedAt: undefined, products: [], environment: 0 };
74
+ return { id: "", status: 0, createdAt: undefined, updatedAt: undefined, products: [], environment: 0, metadata: {} };
75
75
  }
76
76
  export const Order = {
77
77
  $type: "devvit.payments.v1alpha.Order",
@@ -94,6 +94,9 @@ export const Order = {
94
94
  if (message.environment !== 0) {
95
95
  writer.uint32(64).int32(message.environment);
96
96
  }
97
+ Object.entries(message.metadata).forEach(([key, value]) => {
98
+ Order_MetadataEntry.encode({ key: key, value }, writer.uint32(8010).fork()).ldelim();
99
+ });
97
100
  return writer;
98
101
  },
99
102
  decode(input, length) {
@@ -139,6 +142,15 @@ export const Order = {
139
142
  }
140
143
  message.environment = reader.int32();
141
144
  continue;
145
+ case 1001:
146
+ if (tag !== 8010) {
147
+ break;
148
+ }
149
+ const entry1001 = Order_MetadataEntry.decode(reader, reader.uint32());
150
+ if (entry1001.value !== undefined) {
151
+ message.metadata[entry1001.key] = entry1001.value;
152
+ }
153
+ continue;
142
154
  }
143
155
  if ((tag & 7) === 4 || tag === 0) {
144
156
  break;
@@ -155,6 +167,12 @@ export const Order = {
155
167
  updatedAt: isSet(object.updatedAt) ? fromJsonTimestamp(object.updatedAt) : undefined,
156
168
  products: globalThis.Array.isArray(object?.products) ? object.products.map((e) => Product.fromJSON(e)) : [],
157
169
  environment: isSet(object.environment) ? environmentFromJSON(object.environment) : 0,
170
+ metadata: isObject(object.metadata)
171
+ ? Object.entries(object.metadata).reduce((acc, [key, value]) => {
172
+ acc[key] = String(value);
173
+ return acc;
174
+ }, {})
175
+ : {},
158
176
  };
159
177
  },
160
178
  toJSON(message) {
@@ -177,6 +195,15 @@ export const Order = {
177
195
  if (message.environment !== 0) {
178
196
  obj.environment = environmentToJSON(message.environment);
179
197
  }
198
+ if (message.metadata) {
199
+ const entries = Object.entries(message.metadata);
200
+ if (entries.length > 0) {
201
+ obj.metadata = {};
202
+ entries.forEach(([k, v]) => {
203
+ obj.metadata[k] = v;
204
+ });
205
+ }
206
+ }
180
207
  return obj;
181
208
  },
182
209
  create(base) {
@@ -190,10 +217,84 @@ export const Order = {
190
217
  message.updatedAt = object.updatedAt ?? undefined;
191
218
  message.products = object.products?.map((e) => Product.fromPartial(e)) || [];
192
219
  message.environment = object.environment ?? 0;
220
+ message.metadata = Object.entries(object.metadata ?? {}).reduce((acc, [key, value]) => {
221
+ if (value !== undefined) {
222
+ acc[key] = globalThis.String(value);
223
+ }
224
+ return acc;
225
+ }, {});
193
226
  return message;
194
227
  },
195
228
  };
196
229
  messageTypeRegistry.set(Order.$type, Order);
230
+ function createBaseOrder_MetadataEntry() {
231
+ return { key: "", value: "" };
232
+ }
233
+ export const Order_MetadataEntry = {
234
+ $type: "devvit.payments.v1alpha.Order.MetadataEntry",
235
+ encode(message, writer = _m0.Writer.create()) {
236
+ if (message.key !== "") {
237
+ writer.uint32(10).string(message.key);
238
+ }
239
+ if (message.value !== "") {
240
+ writer.uint32(18).string(message.value);
241
+ }
242
+ return writer;
243
+ },
244
+ decode(input, length) {
245
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
246
+ let end = length === undefined ? reader.len : reader.pos + length;
247
+ const message = createBaseOrder_MetadataEntry();
248
+ while (reader.pos < end) {
249
+ const tag = reader.uint32();
250
+ switch (tag >>> 3) {
251
+ case 1:
252
+ if (tag !== 10) {
253
+ break;
254
+ }
255
+ message.key = reader.string();
256
+ continue;
257
+ case 2:
258
+ if (tag !== 18) {
259
+ break;
260
+ }
261
+ message.value = reader.string();
262
+ continue;
263
+ }
264
+ if ((tag & 7) === 4 || tag === 0) {
265
+ break;
266
+ }
267
+ reader.skipType(tag & 7);
268
+ }
269
+ return message;
270
+ },
271
+ fromJSON(object) {
272
+ return {
273
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
274
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
275
+ };
276
+ },
277
+ toJSON(message) {
278
+ const obj = {};
279
+ if (message.key !== "") {
280
+ obj.key = message.key;
281
+ }
282
+ if (message.value !== "") {
283
+ obj.value = message.value;
284
+ }
285
+ return obj;
286
+ },
287
+ create(base) {
288
+ return Order_MetadataEntry.fromPartial(base ?? {});
289
+ },
290
+ fromPartial(object) {
291
+ const message = createBaseOrder_MetadataEntry();
292
+ message.key = object.key ?? "";
293
+ message.value = object.value ?? "";
294
+ return message;
295
+ },
296
+ };
297
+ messageTypeRegistry.set(Order_MetadataEntry.$type, Order_MetadataEntry);
197
298
  function toTimestamp(date) {
198
299
  const seconds = Math.trunc(date.getTime() / 1000);
199
300
  const nanos = (date.getTime() % 1000) * 1000000;
@@ -215,6 +316,9 @@ function fromJsonTimestamp(o) {
215
316
  return fromTimestamp(Timestamp.fromJSON(o));
216
317
  }
217
318
  }
319
+ function isObject(value) {
320
+ return typeof value === "object" && value !== null;
321
+ }
218
322
  function isSet(value) {
219
323
  return value !== null && value !== undefined;
220
324
  }